hook-woocommerce

Custom category page title in Woocommerce

安稳与你 提交于 2021-01-28 14:38:10
问题 On some Woocommerce category pages I would like to change the default Category Page title to something custom. I dont want to change the original "name" on the backend. Is there some code that I can use for this in functions.php? 回答1: The following will allow you to customize the page title on Woocommerce product category pages, for specific product categories: add_filter( 'woocommerce_page_title', 'customize_woocommerce_page_title', 10, 1 ); function customize_woocommerce_page_title( $page

Add a prefix to WooCommerce product titles based on categories

让人想犯罪 __ 提交于 2021-01-28 14:00:26
问题 Is there any chance to have a prefix title for specific categories of woocommerce products? For example: If I add an RTX 2080Ti to GPU Category the title needs to be [GPU] RTX 2080Ti. I have tried many codes around the internet but couldn't reach my target. add_filter('wp_title', 'WPSE_20181106_prepend_title', 10, 3); function WPSE_20181106_prepend_title($title, $sep, $seplocation) { // not a single post if (!is_singular('post')) { return $title; } // IDs of categories that should prepend the

Add a prefix to WooCommerce product titles based on categories

ぐ巨炮叔叔 提交于 2021-01-28 13:58:22
问题 Is there any chance to have a prefix title for specific categories of woocommerce products? For example: If I add an RTX 2080Ti to GPU Category the title needs to be [GPU] RTX 2080Ti. I have tried many codes around the internet but couldn't reach my target. add_filter('wp_title', 'WPSE_20181106_prepend_title', 10, 3); function WPSE_20181106_prepend_title($title, $sep, $seplocation) { // not a single post if (!is_singular('post')) { return $title; } // IDs of categories that should prepend the

Display product ACF fields on a specific WooCommerce email

為{幸葍}努か 提交于 2021-01-28 13:54:05
问题 So I almost got it, but this last detail of specifying WooCommerce emails is leaving my head in a bit of a knot here. I need to show ACF (advanced custom fields) fields of products (in this case it's a custom shipping time) But only in the new order email (processing order and waiting payment order sent to the client) and then new order email to admin. This was the main way I found: "Display product ACF field value in Woocommerce transaction emails" Thank you in advance @LoicTheAztec I also

Display product ACF fields on a specific WooCommerce email

醉酒当歌 提交于 2021-01-28 13:48:34
问题 So I almost got it, but this last detail of specifying WooCommerce emails is leaving my head in a bit of a knot here. I need to show ACF (advanced custom fields) fields of products (in this case it's a custom shipping time) But only in the new order email (processing order and waiting payment order sent to the client) and then new order email to admin. This was the main way I found: "Display product ACF field value in Woocommerce transaction emails" Thank you in advance @LoicTheAztec I also

Woocommerce Gateway default order status customization

隐身守侯 提交于 2021-01-28 12:15:06
问题 I've used the following code which works fine, it makes all orders default status to be on hold. /** * Auto Complete all WooCommerce orders. */ add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order' ); function custom_woocommerce_auto_complete_order( $order_id ) { if ( ! $order_id ) { return; } $order = wc_get_order( $order_id ); $order->update_status( 'on-hold' ); } But I need to combine this with shipping/billing address. i.e. execute this code Only if the order's

Discount based on item quantity count for a category in WooCommerce cart

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-28 10:05:48
问题 I have a category of products that are all priced at $15. When the user buys between 10 & 20 products from this category they should receive a discounted price of $10. When the user buys 20+ the price changes again to $5. The user cannot have a custom role assigned to them (like wholesaler). I created code loosely based on LoicTheAztec code from another question and added my own modifications and code. It looks like it should work. I receive no errors but it does not work. add_action(

Discount based on item quantity count for a category in WooCommerce cart

大城市里の小女人 提交于 2021-01-28 10:01:55
问题 I have a category of products that are all priced at $15. When the user buys between 10 & 20 products from this category they should receive a discounted price of $10. When the user buys 20+ the price changes again to $5. The user cannot have a custom role assigned to them (like wholesaler). I created code loosely based on LoicTheAztec code from another question and added my own modifications and code. It looks like it should work. I receive no errors but it does not work. add_action(

Display specific custom product attributes on single product pages in Woocommerce

白昼怎懂夜的黑 提交于 2021-01-28 06:42:29
问题 I found the following code to display all custom attributes on a product detail page (with a specific bar-style design that I need). The code works like a charm and I have the proper CSS to display horizontal bars of my custom attributes. Problem I have is that I only want to display specific named attributes and don't know how to change the loop to do that... function isa_woocommerce_all_pa(){ global $product; $attributes = $product->get_attributes(); if ( ! $attributes ) { return; } $out =

How to get product categories for the current order item?

空扰寡人 提交于 2021-01-28 05:29:56
问题 I am trying to get the product categories for the woocommerce order item at woocommerce_checkout_create_order_line_item hook. I am able to successfully get the product_id (thanks to help I got here) but now trying to get the product's categories the array comes back empty trying $product->get_categories() and alternatively trying wc_get_product_category_list($product->get_id(). I can't figure out what I am doing wrong. add_action('woocommerce_checkout_create_order_line_item', 'add_order_item