product

Display a Sold out greyed button if all variations are out of stock in Woocommerce

岁酱吖の 提交于 2021-02-07 11:16:03
问题 I am looking for a solution to a problem I have... I have products in Woocommerce, with variations. If ALL variations are out of stock, I want to change the Add to Cart button text to say "Sold out" and edit the CSS of the button also (change it's color) BEFORE a variation is selected in the dropdown... So here's a scenario: I goto a variable product single page. The product has 4 variations: CURRENTLY: The "add to cart" button displays (greyed out) and can be clicked before a variation is

Display a Sold out greyed button if all variations are out of stock in Woocommerce

佐手、 提交于 2021-02-07 11:15:44
问题 I am looking for a solution to a problem I have... I have products in Woocommerce, with variations. If ALL variations are out of stock, I want to change the Add to Cart button text to say "Sold out" and edit the CSS of the button also (change it's color) BEFORE a variation is selected in the dropdown... So here's a scenario: I goto a variable product single page. The product has 4 variations: CURRENTLY: The "add to cart" button displays (greyed out) and can be clicked before a variation is

Change “No Product” message in Woocommerce

落花浮王杯 提交于 2021-02-07 09:25:38
问题 I have the problem at the first Woocommerce page. I don't have any product at the shop. For this reason, Woocommerce shows "No Products" message on the first page. Now I want to change this message. How do I do this? Shop address: http://shahroodantenna.ir/shop/ 回答1: Try the following, where you can customize the "No Product" message: add_action( 'woocommerce_no_products_found', function(){ remove_action( 'woocommerce_no_products_found', 'wc_no_products_found', 10 ); // HERE change your

Change “No Product” message in Woocommerce

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-07 09:25:20
问题 I have the problem at the first Woocommerce page. I don't have any product at the shop. For this reason, Woocommerce shows "No Products" message on the first page. Now I want to change this message. How do I do this? Shop address: http://shahroodantenna.ir/shop/ 回答1: Try the following, where you can customize the "No Product" message: add_action( 'woocommerce_no_products_found', function(){ remove_action( 'woocommerce_no_products_found', 'wc_no_products_found', 10 ); // HERE change your

Get the product ID in WooCommerce 3+ Order items

限于喜欢 提交于 2021-02-07 08:01:49
问题 I am trying to get woocommerce thank you page order_id. Using the code below. But unfortunately I can't get it. add_action( 'woocommerce_thankyou', 'bbloomer_check_order_product_id'); function bbloomer_check_order_product_id( $order_id ){ $order = new WC_Order( $order_id ); $items = $order->get_items(); foreach ( $items as $item ) { $product_id = $item['product_id']; if ( $product_id == XYZ ) { // do something } } } 回答1: This code is outdated for WooCommerce version 3+. You should use instead

Woocommerce: function to update all products

孤人 提交于 2021-02-06 13:01:09
问题 I have an issue with my Woocommerce products. This issue is fixed if I just update the product (edit the product and click in the Update button) with no changes at all. I have around 2000 products in my site, then I am thinking of doing this using a function in my function.php file. It should be something like this, I just need the line which update the product. function update_all_products(){ // getting all products $products = get_posts( $args ); // Going through all products foreach (

Woocommerce: function to update all products

北战南征 提交于 2021-02-06 12:58:50
问题 I have an issue with my Woocommerce products. This issue is fixed if I just update the product (edit the product and click in the Update button) with no changes at all. I have around 2000 products in my site, then I am thinking of doing this using a function in my function.php file. It should be something like this, I just need the line which update the product. function update_all_products(){ // getting all products $products = get_posts( $args ); // Going through all products foreach (

Change “add to cart” text if a user has bought specific products in WooCommerce

懵懂的女人 提交于 2021-02-05 12:13:37
问题 I wanted to know if there is a way to replace the woo-commerce "add to cart" button with custom text and url for a specific product if the user has bought that specific product. and I want it happens everywhere (on shop page,product page , ...) 回答1: Try the following that will change the product "add to cart" text if that product has already been bought by the customer on single product pages and archive pages add_filter( 'woocommerce_product_add_to_cart_text', 'custom_add_to_cart_text', 900,

Change “add to cart” text if a user has bought specific products in WooCommerce

点点圈 提交于 2021-02-05 12:13:34
问题 I wanted to know if there is a way to replace the woo-commerce "add to cart" button with custom text and url for a specific product if the user has bought that specific product. and I want it happens everywhere (on shop page,product page , ...) 回答1: Try the following that will change the product "add to cart" text if that product has already been bought by the customer on single product pages and archive pages add_filter( 'woocommerce_product_add_to_cart_text', 'custom_add_to_cart_text', 900,

Add a product subtitle in Woocommerce archives pages

冷暖自知 提交于 2021-02-05 09:23:31
问题 I can add a subtitle to my product title by adding the following code to single-product/title.php: the_title( '<h1 class="product_title entry-title">', '</h1>' ); echo "<p>My subtile</p>"; The problem is that this only appears on the product page. Not on other views such as the shop view: I have looked everywhere and cannot find out where to modify the title for other views of the WooCommerce store? 回答1: Updated - To add a product subtitle in archives pages like shop use the following: add