Javascript JS事件不';无法在购物车页面上正常工作
我使用此脚本将数字转换为其他格式:Javascript JS事件不';无法在购物车页面上正常工作,javascript,jquery,events,woocommerce,Javascript,Jquery,Events,Woocommerce,我使用此脚本将数字转换为其他格式: jQuery(document).ready( function(){ jQuery( 'body' ) .on( 'update_checkout updated_checkout updated_cart_totals', function() { var els = document.querySelectorAll('.woocommerce-Price-amount, .amount, .product-quant
jQuery(document).ready( function(){
jQuery( 'body' )
.on( 'update_checkout updated_checkout updated_cart_totals', function() {
var els = document.querySelectorAll('.woocommerce-Price-amount, .amount, .product-quantity');
els.forEach(function(item) {
item.textContent = persianJs(item.textContent).englishNumber().toString();
});
});
});
它可以在结帐页面工作,但不能在购物车页面正常工作;更改产品数量并单击更新购物车按钮后,我看到的是产品名称前面的“数量”短语,而不是数量值(编号)
这是cart.php中的相关代码:
$product_quantity = woocommerce_quantity_input(
array(
'input_name' => "cart[{$cart_item_key}][qty]",
'input_value' => $cart_item['quantity'],
'max_value' => $_product->get_max_purchase_quantity(),
'min_value' => '0',
'product_name' => $_product->get_name(),
),
$_product,
false
);
阅读<代码>数量值<代码>与<代码>项目.文本内容<代码>是否存在冲突?我曾在签出页面中使用<代码>.产品数量<代码>,但现在将其更改为<代码>强。产品数量<代码>现在脚本在购物车和签出页面中都可以使用