Go to file
2023-05-18 12:43:54 +01:00
les-variations-js-free.php Initial commit 2023-05-18 12:26:20 +01:00
README.md Added README 2023-05-18 12:43:54 +01:00

Woocommerce - JS-free variation shopping

Why?

Variable products in Woocommerce have variable IDs, which are used server side to add the correct product variant to the user's cart. Unfortuntely, these are sent in the form through the use of JQuery, which requires Javascript. Incredibly cringe.

Therefore, I decided to create a solution which allows for users to still shop, without enabling or supporting Javascript in their browser.

How?

Firstly, this plugin hooks the add-to-cart handler to modify the string returned for variable products, so that a custom action is called to handle them, rather than the default behaviour.

This custom action then collects the attributes and product ID the user sent in their request and constructs an SQL query to retrieve the correct variation ID for the attributes the user selected (prepared statements so you don't get RCE by accident LOL). Then, this is used to add the correct product variation to the cart, and finally redirects the user to the basket page after.

Hey goy, I found a hecking bug!

Email me at jacob.eva@liberatedsystems.co.uk and I'll investigate.