Variable product selectors: Getting the live selected values

后端 未结 2 620
死守一世寂寞
死守一世寂寞 2020-12-16 06:59

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\         


        
2条回答
  •  猫巷女王i
    2020-12-16 07:48

    It should'nt be 'case' it should 'Case', strstr is a case sensitive function and as it is boolean the below statment will return false always. Because the values in ur selector is Case (20 dozens) not case (20 dozens) See the reference below to know more.

    Thus change the below line:

    $has_case = strstr($last_variation_attribute_slug_value, 'case');
    

    to:

    $has_case = strstr($last_variation_attribute_slug_value, 'Case');
    

    ref: https://www.w3schools.com/php/func_string_strstr.asp

提交回复
热议问题