Skip to content
Advertisement

Woocommerce variable subscription custom field checkbox set default as unchecked

Below is my code in which I have set a custom field called mindesk_analytics_opt_out for my Variable Subscriptions and it’s working fine as per my expectations.

However, Whenever I create a new variation and open the panel, my default checkbox always set as checked. I cant understand where I have done wrong here in my code.

Can someone guide me please where I made a small mistake? Here is my working code.

JavaScript

Any advice or suggestion would be highly appreciated.

Advertisement

Answer

Updated: Instead use the following function replacement (checkbox will be unchecked by default)

JavaScript

Tested and works


This part doesn’t need changes:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement