WooCommerce:将表单元素添加到variable.php会破坏数量功能
我在WooCommerce:将表单元素添加到variable.php会破坏数量功能,woocommerce,Woocommerce,我在singleproduct/addtocart/variable.php的表单中添加了两个额外的表单元素(单选按钮)。现在数量字段不起作用:例如,如果我选择“5”,单击添加到购物车按钮并访问我的购物车,只添加了1项而不是5项。如果我删除多余的元素,它会再次工作。关于发生了什么有什么建议吗 我在do_action之后添加了我的表单元素('woocommerce_之后是'u single_variation'): <?php do_action( 'woocommerce_after_si
singleproduct/addtocart/variable.php
的表单中添加了两个额外的表单元素(单选按钮)。现在数量字段不起作用:例如,如果我选择“5”,单击添加到购物车
按钮并访问我的购物车,只添加了1项而不是5项。如果我删除多余的元素,它会再次工作。关于发生了什么有什么建议吗
我在do_action之后添加了我的表单元素('woocommerce_之后是'u single_variation')代码>:
<?php do_action( 'woocommerce_after_single_variation' ); ?>
<div class="auto_replenish_wrap">
<div class="auto_replenish_option">
<input type="radio" name="auto_replenish" value="auto_replenish_no" checked="checked">
<label for="auto_replenish_no">
Deliver one-time only
</label>
</div>
<div class="auto_replenish_option">
<input type="radio" name="auto_replenish" value="auto_replenish_yes">
<label for="auto_replenish_yes">
<div class="auto_replenish_yes_label">
Auto-replenish <a href='#'>(See details)</a>
</div>
<div class="auto_replenish_yes_label_frequency">
<span class="delivery_frequency">
Deliver every
<input type="button" class="minus" value="-">
<input type="text" size="4" class="input-text qty text" title="Qty" value="1" name="quantity" step="1" pattern="[0-9]*" id="delivery_frequency_value" min="1">
<input type="button" class="plus" value="+">
month(s)
</span>
</div>
</label>
</div>
</div>
<div class="add_to_cart_and_learn_more">
<a class="learn_more_after_add_to_cart_button" href="<?php the_permalink(); ?>">Learn More</a>
</div>
一次性交付
自动补充
交付
月份
您能显示您的代码吗?另外,根据过去的经验,如果可以将字段添加到钩子中,我始终认为这比覆盖添加到购物车模板要好。我刚刚不得不为客户拯救了太多损坏的网站。嘿,赫尔加:)我在问题中添加了代码!我还尝试通过您的网站与您联系(关于其他事项),但它不允许我发送消息,我尝试使用FF和Chrome。您为交付频率\u值添加的输入与数量按钮同名,即:name=“quantity”
。WooCommerce可能是从您的新输入中提取数量值,而不是预期值。正是问题所在,谢谢!