<commit_before><?php

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/** @var WC_Aplazame $aplazame */
global $aplazame;
if ( ! $aplazame->enabled ) {
	return;
}

/** @var WC_Product $product */
global $product;
?>

<div
	data-aplazame-simulator=""
	data-view="product"
	data-amount="<?php echo Aplazame_Filters::decimals( $product->get_price() ); ?>"
	data-currency="<?php echo get_woocommerce_currency(); ?>"
	data-stock="<?php echo $product->is_in_stock() ? 'true' : 'false'; ?>">
</div><commit_msg>Fix aplazame widget simulator does not update when variable product amount change<commit_after><?php

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/** @var WC_Aplazame $aplazame */
global $aplazame;
if ( ! $aplazame->enabled ) {
	return;
}

/** @var WC_Product $product */
global $product;

switch ($product->get_type()) {
	case 'variable':
		$price_selector = '#main [itemtype="http://schema.org/Product"] .woocommerce-variation-price .amount';
		break;
	default:
		$price_selector = '#main [itemtype="http://schema.org/Product"] [itemtype="http://schema.org/Offer"] .price .amount';
}
?>

<div
	data-aplazame-simulator=""
	data-view="product"
	data-price='<?php echo $price_selector; ?>'
	data-amount="<?php echo Aplazame_Filters::decimals( $product->get_price() ); ?>"
	data-currency="<?php echo get_woocommerce_currency(); ?>"
	data-stock="<?php echo $product->is_in_stock() ? 'true' : 'false'; ?>">
</div>
{'fraction_non_alphanumeric': 0.2037037037037037, 'fraction_numerical': 0.0, 'mean_word_length': 5.18942731277533, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3687315', 'n_tokens_mistral': 521, 'n_tokens_neox': 524, 'n_words': 98}