简体   繁体   中英

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. 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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM