variations

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

Variable product selectors: Getting the live selected values

我的未来我决定 提交于 2019-12-18 04:23:05
问题 In WooCommerce use the code below to add a custom label after product prices in simple and variables products: add_filter('woocommerce_variation_price_html','prices_custom_labels', 10, 2 ); add_filter('woocommerce_price_html','prices_custom_labels', 10, 2 ); function prices_custom_labels( $price, $product ){ // Set HERE your custom labels names $per_dozen = ' '. __('per dozen', 'woocommerce' ); $per_case = ' '. __('per case (20 dozens)', 'woocommerce' ); // 1) Variable products if ($product-

Show Message in Woocommerce Cart only for specific product variation Attribute

核能气质少年 提交于 2019-12-13 00:37:31
问题 I am adding a custom message to the Cart page, but so that it only appears if an added product has a custom variation atribute selected. After researching I came up to: add_action( 'woocommerce_after_cart', 'wnd_after_cart' ); function wnd_after_cart() { if($attribute_slug == 'no_review'){ echo '<div class="wnd_after_cart"><h4>There will be no item manual review</h4><br /> </div>'; } } But its not working. Does anyone know what am I doing wrong? add_action( 'woocommerce_after_cart', 'wnd

String Variations

旧街凉风 提交于 2019-12-13 00:28:08
问题 I have a string in python and a dictionary of 'rules', or possible alterations to the string. For example, one rule might have a key of 'he' and a value of 'e' , or a key of 'll' and a value of 'l' . These rules would mean that any occurrence of ``'he' in my string can be replaced with an 'e' , and similarly for 'll' and 'l' . What I want is to find all variations of my string, given this dictionary of rules. For instance, with the two rules from above and the string 'hello' , I would like to

Get the selected product variation ID in WooCommerce variable products single pages

蹲街弑〆低调 提交于 2019-12-12 18:08:50
问题 For my Woocommerce variable products I'm implementing a custom size chooser on the single product page and have this sizes in a table: These variations are just: 30B 30C 30D rather than being split in to: 30 and B C D What I am trying to figure out is: How to grab the shipping class for each product variations? I have something similar on cart page but I don't know what is the variation ID or how to get it from the single product page: $product_id = ( 0 != $cart_item['variation_id'] ) ? $cart

Checking that a specific attribute value is used in a cart Item (product variation)

若如初见. 提交于 2019-12-12 13:12:38
问题 In WooCommerce, I would like to check if the products in the shopping cart have the attribute 'Varifocal' (so I can show/hide checkout fields). I'm struggling to get an array of id's of all the variations which have the attribute 'varifocal'. It would be really appreciated if someone can point me in the right direction. The taxonomy is pa_lenses . I currently have the following function: function varifocal() { // Add product IDs here $ids = array(); // Products currently in the cart $cart_ids

2D Bit matrix with every possible combination

£可爱£侵袭症+ 提交于 2019-12-12 01:55:44
问题 I need to create a python generator which yields every possible combination of a 2D bit matrix. The length of each dimention is variable. So for a 2x2 matrix: 1. 00 00 2. 10 00 3. 11 00 .... x. 00 01 Higher lengths of the dimentions (up to 200*1000) need to work too. In the end I will not need all of the combinations. I need only the once where the sum in each line is 1. But I need all combinations where this is the case. I would filter them before yielding. Printing is not required. I want

Get currently selected variation id from Woocommerce variable product

霸气de小男生 提交于 2019-12-11 19:04:07
问题 Situation: I have a bunch of variable products in a Wordpress WooCommerce shop. On the frontend there is a form with multiple select inputs, that let the user configure the product before adding it to the cart. The price and other information will change across the possible variations, so I need to keep track of that. Aim: After the form has been changed by the user, Woocommerce will update a hidden field input.variation_id with the ID of the newly selected variation. Whenever that changes, I

Customizing product variations message on single product pages

血红的双手。 提交于 2019-12-11 06:09:57
问题 I got a WooCommerce website, which hides the prices for not logged in users, and apparently it works fine, except with product variations, that even if it does what it should, is not properly done, or at least not the way I would do it. I hides the price of the variable product, but allows you to choose options (which is fine, that way you might encourage users to register) the problem is that when you finish choosing the variables, it shows the following message "Sorry, this product is