Wordpress WooCommerce JavaScript Help Needed (Small Function Needed)
Budget: $14 – $30 NZD
WHAT WE REQUIRE
We are building a WooCommerce store for our small business. We do not have expertise in JavaScript, and require assistance for a small job.
All our products are created as Variable Products. They are also all Virtual and Downloadable.
We require you to create a JS function that works on the post-new.php and edit.php?post_type=product admin pages that does the following:
When a new Variation is created of the product, they are automatically defaulted to Virtual and Downloadable (i.e the checkboxes both become ticked). We believe this behaviour could most easily happen when the Variation Regular Price is ‘focused’ upon.
Attached you will find a video which might help you understand what we require.
As I said, we do not have expertise in JavaScript and would like someone to make this work for us. The best we have managed is as follows but it doesn’t work (perhaps because some of the elements aren’t loaded in the DOM at page creation and so the JS isn’t working)
//////////////////////////////////////FUNCTION//////////////////////////////////////////
//Force Virtual and Downloadable Checkboxes in Variable Tickets to Ticked and Ticked
document.querySelector('input[name^=variable_regular_price]').addEventListener('focus', ()=>{
document.querySelector('input[name^=variable_is_downloadable]').checked=true
document.querySelector('input[name^=variable_is_virtual]').checked=true
})
//////////////////////////////////////FUNCTION//////////////////////////////////////////
NOTES FOR YOU:
You will need an standard install of Wordpress and standard install of WooCommerce. You must have previous WooCommerce experience.
We DO NOT have site access for you.
This is a simple job requiring a simple function to be built which we will test on our local site.
We are building a WooCommerce store for our small business. We do not have expertise in JavaScript, and require assistance for a small job.
All our products are created as Variable Products. They are also all Virtual and Downloadable.
We require you to create a JS function that works on the post-new.php and edit.php?post_type=product admin pages that does the following:
When a new Variation is created of the product, they are automatically defaulted to Virtual and Downloadable (i.e the checkboxes both become ticked). We believe this behaviour could most easily happen when the Variation Regular Price is ‘focused’ upon.
Attached you will find a video which might help you understand what we require.
As I said, we do not have expertise in JavaScript and would like someone to make this work for us. The best we have managed is as follows but it doesn’t work (perhaps because some of the elements aren’t loaded in the DOM at page creation and so the JS isn’t working)
//////////////////////////////////////FUNCTION//////////////////////////////////////////
//Force Virtual and Downloadable Checkboxes in Variable Tickets to Ticked and Ticked
document.querySelector('input[name^=variable_regular_price]').addEventListener('focus', ()=>{
document.querySelector('input[name^=variable_is_downloadable]').checked=true
document.querySelector('input[name^=variable_is_virtual]').checked=true
})
//////////////////////////////////////FUNCTION//////////////////////////////////////////
NOTES FOR YOU:
You will need an standard install of Wordpress and standard install of WooCommerce. You must have previous WooCommerce experience.
We DO NOT have site access for you.
This is a simple job requiring a simple function to be built which we will test on our local site.