[英]Custom quantity field functionality issue on WooCommerce archive pages
I am using " Show quantity box with add to cart ajax enabled in Woocommerce shop page " answer code successfully, to display a quantity box to the Ajax add to cart buttons of my products on the category pages. 我正在使用“ 在Woocommerce商店页面中显示添加到购物车ajax的数量框 ”成功回答代码,在类别页面上显示数量框到我的产品的Ajax添加到购物车按钮。 That allows customer to add to cart multiple quantities at once for simple products on archive pages.
这允许客户一次性为存档页面上的简单产品添加多个数量的购物车。
My question: How do I can change hooks involved on my archive pages to change the location of a custom quantity field for my simple products? 我的问题:如何更改存档页面中涉及的挂钩以更改我的简单产品的自定义数量字段的位置?
If you take a look at a simple product (not variable products) in my website shop page , the top quantity selector is the Ajax add to cart function, I want it to be positioned where the other quantity selector is (or replace it if possible), not be positioned above the products title. 如果您在我的网站商店页面中查看一个简单的产品(不是可变产品) ,那么顶部数量选择器是Ajax添加到购物车功能,我希望它被定位在另一个数量选择器所在的位置(或者如果可能的话替换它) ),不得位于产品标题之上。
Reason I have added this function to override the Ajax that the website currently has is because the old one only allowed me to add 1 quantity on anything when using Ajax. 原因我添加了这个函数来覆盖网站当前拥有的Ajax,因为旧的只允许我在使用Ajax时添加任意数量的数据。
Any help is appreciated. 任何帮助表示赞赏。
You should not attempt to re-order hooks as even if successful it would potentially break other functionality if not now then in future if other plugins are added. 您不应该尝试重新订购挂钩,因为即使成功它也可能会破坏其他功能,如果不是现在,那么将来如果添加了其他插件。
Your options are to: Use the filter to remove a piece of functionality from one hook and add it to the other in the order you want. 您可以选择:使用过滤器从一个钩子中删除一个功能,然后按照您想要的顺序将其添加到另一个钩子中。 Or Create an override template in your theme that either has the hooks called in the order you want (as mentioned not recommended) or add your own hook/functionality in the place you want it.
或者在主题中创建一个覆盖模板,该模板要么按照您想要的顺序调用钩子(如不推荐所述),要么在您想要的位置添加自己的钩子/功能。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.