WooCommerce: trigger event after change of variation

前端 未结 3 1836
刺人心
刺人心 2020-12-02 10:58

We use Woocommerce to sell colorboxes. Mostly the variable-product option is chosen.

We added a modal dialog with a color palette, where the customer can chose a co

3条回答
  •  情书的邮戳
    2020-12-02 11:43

    if anyone comes here like me to find the answer, I will provide a clarification in this.

    We have a problem implementing the change function because we need to know the price of variation selected but 'woocommerce_variation_select_change' we got the price from previous variation.

    So if you want to get the price of variation after change finish, you have to use 'woocommerce_variation_has_changed' jQuery function.

    Example:

    jQuery('#select_attribute_of_variation').on('woocommerce_variation_has_changed', function(){ // do your magic here... })

提交回复
热议问题