In addition to the WooCommerce product home page, I coded a second page template (with the wordpress page template function https://developer.wordpress.org/themes/template-files-section/page-templates/) that shows the woocommerce products in another schema.
... we call it „speed buy“, there is no informations about the products, just a list with title, price and the add to cart button.
My problem is, that we want to have not the normal add to cart button, but the add to cart button with quantity. Actually we call the add to cart button with
<?php do_action( 'woocommerce_after_shop_loop_item' ); ?>
But this is the normal one without quantity.. any ideas?
Edit: We display the products on the page-template with a custom loop / WP_Query.
Related
In Woocommerce, I have some great code in my functions.php file which puts an "add to cart" button underneath the products in the main shop page. This is it:
add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 20 );
That's great! But I'm now changing some products to variable products and it says "select options" underneath instead.
Can I alter this code so that it only displays on a page showing products from certain categories?
In other words, the main shop page has the variable products (no add to cart buttons), but I also have category pages showing simple products which display the add to cart buttons as per the code above.
Many thanks!
You would remove the action from specific product categories using a conditional tag as its already displayed by default.
is_product_category()
Make sure you use a hook which fires before its added.
I am looking for the next solution in WooCommerce
Currently, when a customer clicks the product image on an archive page in WooCommerce, the single product page opens.
However, I would like to add the functionality that the product is immediately added to the shopping cart as opposed to opening the single product page
I don't know which code to apply but I tried with below code
add_filter ('woocommerce_product_single_add_to_cart_text', 'custom_add_to_cart_button_woocommerce');
I have items that are using Woocommerce Product Add-ons. This plugin uses the POST method, however I wanted to keep the Ajax buttons for the other products.
Based on "Remove add to cart button for specific product categories in WooCommerce 3" answer code That removes the add-to-cart button for specific product tags on single product pages, but problem now is I have no button to show.
The code replace also the ajax add to cart button by a button linked to the product and on single product pages, when hitting RETURN/ENTER key, the product is added to cart, which is exactly what I wanted. However, I want to have a Buy Now or Submit button in place. What should I do?
I am new to Wordpress. I am developing store by using Woocommerce. When a product is added to cart then they must be hidden on the website for a specific time so that those products that are in the cart by any other user, not available on the website.
How can I do this?
I searched a lot but found nothing.
If you want to remove add to cart button from the products which are already in cart then you will need to check for the products' ID from the woocommerce cart session. and then use the filter hook woocommerce_is_purchasable.
add_filter('woocommerce_is_purchasable', 'coder_woocommerce_is_purchasable', 10, 2);
function coder_woocommerce_is_purchasable($is_purchasable, $product) {
return ($product->id == cart_session_product_id ? false : $is_purchasable);
}
In this way, you can hide the add to cart button.
If you want to hide the product itself then in woocommerce product loop in shop page, Just compare the product id from the woocommerce session cart and traverse the loop. If ID matches then skip that product. Customize this products loop of shop page in woocommerce theme template.
I am trying to add a button above the add to cart button on the product category page.
I have found the code for the single product page but not the product pages. Where can I find it?