From a344f695edbb733ed5128c0ff09367c96f8d0c55 Mon Sep 17 00:00:00 2001 From: "jacob.eva" Date: Thu, 18 May 2023 12:43:54 +0100 Subject: [PATCH] Added README --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..f52b7b0 --- /dev/null +++ b/README.md @@ -0,0 +1,23 @@ +# 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.