custom-taxonomy

Set a specific product price conditionally on Woocommerce single product page & cart

会有一股神秘感。 提交于 2019-12-19 10:07:52
问题 In Woocommerce I would like to alter the price of a specific product (in this case with an ID of 87) on both the single product page and for related cart items. The product price needs to be increased by $10 but only on the single product page and only externally (so that the internal price or price set in Woocommerce is not altered). Additionally, this price should also be altered in the cart but only if products from a certain category are NOT also in the cart. Context: If someone buys this

Allow backorders and notify customer for parent product categories in Woocommerce

ぃ、小莉子 提交于 2019-12-18 09:28:46
问题 With woocommerce, I used some code based on my previous thread: Allow backorders and notify customer for specific product categories in Woocommerce add_filter( 'woocommerce_product_is_in_stock', 'filter_product_is_in_stock', 10, 2 ); function filter_product_is_in_stock( $is_in_stock, $product ){ // Here set the products categories in the array (can be terms ids, slugs or names) $categories = array("clothing"); if( has_term( $categories, 'product_cat', $product->get_id() ) ){ $is_in_stock =

Targeting product terms from a custom taxonomy in WooCommerce

老子叫甜甜 提交于 2019-12-18 09:17:11
问题 I use some custom taxonomies in my website… movies_type (is one of them) and has 4 terms: movie , tvseries , concert-and-ceremony, documentary I have tagged Every product with just one of this terms. How can I target those products that have the same term? Thanks 回答1: You can use has_term() WordPress function to target your products with terms from a custom taxonomy , just as for product categories which custom taxonomy is "product_cat" For example, you can use it this way: if ( has_term(

Hide Add to Cart button in Woocommerce product variations for a specific attribute value

醉酒当歌 提交于 2019-12-18 09:08:08
问题 In Woocommerce, I'm trying to hide add to cart button for variations with a specific selected value for one of attributes. There are two attributes for each variation ( pa_color and pa_size ) For example for a variable product, we have these options: 1) Red - XL 2) Red - XXL 3) Blue - M 4) Blue - XL I want to hide add to cart button for XL so users could not add options having XL to cart (1 and 4 in this example) P.S: We don't want to disable the variation, so variation image could show up by

Replace default “Select Option” text in Woocommerce variation attribute dropdowns by different custom ones

天涯浪子 提交于 2019-12-18 07:18:49
问题 I am just starting out with Woocommerce and have a question about drop down select field for variable products. In woocommerce when nothing is selected on this dropdowns, "Select Option" text is displayed. I need each dropdown select field option to display a different text when nothing has been selected yet. I found this code which replaces the standard "Select Option" text with what ever I want, but it does to all dropdowns select fields. function custom_woocommerce_product_add_to_cart_text

Change the add to cart text for a specific product category in Woocommerce 3

谁都会走 提交于 2019-12-18 04:30:15
问题 I want to change the add to cart text on product archives on specific categories only. For example, on preorder category i want instead of add to cart text, to be Preorder . I don't know how to identify Preorder category in the below function. add_filter( 'add_to_cart_text', 'woo_archive_custom_cart_button_text' ); // < 2.1 function woo_archive_custom_cart_button_text() { return __( 'Preorder', 'woocommerce' ); } 回答1: Update: add_to_cart_text hook is obsolete & deprecated. It is replaced in

Display Related products for a specific product attribute value in single product pages

删除回忆录丶 提交于 2019-12-14 02:38:53
问题 In Woocommerce, I have set a COLLECTION_ID product attribute for my products. I would like to display all related products to this COLLECTION_ID product attribute value on single product pages. Any suggestions? 回答1: You will have to add your own settings in the "Settings section" inside the function. For the defined product attribute name, this function will take the first corresponding term set for the current product (as an attribute can have many terms in a product) and will display all

When I add custom post type permalink rewrite, my regular post permalinks stop working. Can't get both to work at the same time

萝らか妹 提交于 2019-12-13 13:56:27
问题 really struggling with this one, so any help would be much appreciated. My site has both regular post posts, and a custom post type called "articles." I'm trying to get it to work so that my regular posts will use the /%category%/postname%/ permalink structure, (which I have set up in settings). This is working fine, until I add a custom rewrite for my article post type. I'd like articles to follow a /%issue%/%postname%/ structure. I can get this working great with the following: add_filter(

ACF front end form to create term

蓝咒 提交于 2019-12-13 05:45:11
问题 I want to use ACF frontend form function to create a form with custom fields that is used to create a taxonomy term, in this case a group. I have seen how to implement this with a post and have done so throughout the site but i am unable to implement this to insert a new term. I think i am on the right track but still am having issues with it not adding terms function my_pre_save_post( $post_id ) { // check if this is to be a new post if( $post_id != 'new' ) { return $post_id; } // Create a

Hide Flat Rate shipping exclusively for a product category in Woocommerce

限于喜欢 提交于 2019-12-13 03:50:27
问题 This is an extension of this question: Remove shipping Flat Rate method for particular Category in WooCommerce 2.6 and 3+ Used the Woo Smart Coupons plugin for a Gift Card product. This HAS to be set to Variation, as we have multiple tiers to select from. (this rules out virtual products) The Gift Card has it's own category for distinction. We have two shipping options set up: Flat Rate + Local Pickup. It's pretty silly to have shipping options for a gift card that gets sent to your Inbox, so