product

Products dropdown from same category inside Woocommerce product short description

与世无争的帅哥 提交于 2020-07-03 09:56:50
问题 In Woocommerce, I would like to add a drop down in product short description that shows all products that have the same category(ies). It will be even better if it was possible to go to the product page of the selected product. I didn't see any threads that fulfill what I am trying to do. Any help will be appreciated. 回答1: 2020 Update 4 - Added product_id as argument, allowing the shortcode to be used for a defined product ID (for example on a page). The following will make a custom shortcode

Change order status for virtual, downloadable, free or backorder products in WooCommerce

徘徊边缘 提交于 2020-06-29 04:27:49
问题 i try to slightly modify with +1 check for plugin located here So , for all Virtual Downloadable Free (price=0,00) & on Backorder products I want Woocommerce to set order status 'Processing' the result I have with code below - Woocommerce to set order status 'Pending Payment' Are there any ideas how to switch it to 'Processing': add_action('woocommerce_checkout_order_processed', 'handmade_woocommerce_order'); function handmade_woocommerce_order( $order_id ) { $order = wc_get_order($order_id);

Change order status for virtual, downloadable, free or backorder products in WooCommerce

試著忘記壹切 提交于 2020-06-29 04:27:18
问题 i try to slightly modify with +1 check for plugin located here So , for all Virtual Downloadable Free (price=0,00) & on Backorder products I want Woocommerce to set order status 'Processing' the result I have with code below - Woocommerce to set order status 'Pending Payment' Are there any ideas how to switch it to 'Processing': add_action('woocommerce_checkout_order_processed', 'handmade_woocommerce_order'); function handmade_woocommerce_order( $order_id ) { $order = wc_get_order($order_id);

Append text to product title on multiple pages in WooCommerce

穿精又带淫゛_ 提交于 2020-06-29 04:20:12
问题 I'm trying to append text to WooCommerce product title in the order meta - if products has a specific tag. I'm working from "Append text to product title if product has product-tag on cart in WooCommerce" "Display custom payment field in Woocommerce Admin, Orders and emails" This is what I have so fare: add_filter( 'woocommerce_get_order_item_totals', 'add_udstilling_below_cart_item_name', 10, 3 ); function add_udstilling_below_cart_item_name( $total_rows, $order, $tax_display ) {; $new_total

Access downloadable data from WooCommerce downloadable products

假装没事ソ 提交于 2020-06-28 03:38:39
问题 I'm trying to fetch the WooCommerce products meta data using $product = new WC_Product( get_the_ID() ); I'm getting the product price and all the other values the products are downloadable WooCommerce products, I want to fetch the following data: Whenever i try to fetch $product->downloads->id or $product->downloads->file i'm getting null in return. Please tell me what i'm doing wrong over here. 回答1: To access all product downloads from a downloadable product you will use WC_Product get

How to disable globally backorders in WooCommerce

China☆狼群 提交于 2020-06-27 03:06:48
问题 New products are being added daily to my website and it is unproductive to keep choosing the "Do not allow backorders" option for each new product and out of stock products. Currently with a growing database of over 2,000 products, I am finding it tedious to do the same process daily. Using the functions.php file, is there some php code I can implement to disallow backorders for all existing and future products? Any help is welcome and appreciated. 回答1: Simply use the following line of code

Exclude specific product categories on Woocommerce single product pages

空扰寡人 提交于 2020-06-26 06:51:13
问题 I'm trying to exclude some categories from being displayed on the WooCommerce product page. Example : if in a single product page I have "Categories: Cat1, Cat"2", I want that only Cat1 will be displayed. I tried editing the meta.php in the single-product template. I created a new function: $categories = $product->get_category_ids(); $categoriesToRemove = array(53,76,77,78); // my ids to exclude foreach ( $categoriesToRemove as $categoryKey => $category) { if (($key = array_search($category,

Display product prices with a shortcode by product ID in WooCommerce

落爺英雄遲暮 提交于 2020-06-25 04:16:46
问题 IN WooCommerce I am using the code of this tread to display with a short code the product prices from a defined product ID. But it don't really do what I want. Here is that code: function so_30165014_price_shortcode_callback( $atts ) { $atts = shortcode_atts( array( 'id' => null, ), $atts, 'bartag' ); $html = ''; if( intval( $atts['id'] ) > 0 && function_exists( 'wc_get_product' ) ){ $_product = wc_get_product( $atts['id'] ); $number = number_format($_product->get_price(), 2, '.', ','); $html

Display specific product attributes on Woocommerce archives pages

a 夏天 提交于 2020-06-24 14:01:44
问题 I want to display some specific product attributes of my choice on the store shop page for each product. It is necessary to display the name of the attribute and opposite its value. I started writing code, I wanted to print at least names, but I only show the name of the last attribute add_action('woocommerce_after_shop_loop_item','add_attribute'); function add_attribute() { global $product; $weigth_val = $product->get_attribute('weight'); $quant_val = $product->get_attribute('quantity');

Display specific product attributes on Woocommerce archives pages

只愿长相守 提交于 2020-06-24 14:01:07
问题 I want to display some specific product attributes of my choice on the store shop page for each product. It is necessary to display the name of the attribute and opposite its value. I started writing code, I wanted to print at least names, but I only show the name of the last attribute add_action('woocommerce_after_shop_loop_item','add_attribute'); function add_attribute() { global $product; $weigth_val = $product->get_attribute('weight'); $quant_val = $product->get_attribute('quantity');