Coding New Bridge Plugin – How To? Capture URL Variable / Trigger shortcode
-
Hi,
I’m using WordPress and WooCommerce, and I’ve used both enough to understand what’s going on.
I’m currently working on a site now however, where the catalogue is in an iframe. I know it’s not ideal, but with over 22,000 regularly changing products, I don’t fancy attempting to maintain that.
I’ve imported the essential details of the catalogue so WooCommerce can add the product to the cart, however I’m struggling with the functionality of WooCommerce. It will only add-to-cart via ID, and not the SKU (which is what I require), so I’m going to have to build a plugin to bridge the gap.
I’ve posted in the WooCommerce section prior to now, and Mike has been very helpful with suggestions, however I assume this kind of support is outside the spectrum of what they’re supporting.
What I need to do, is…
I need to capture the SKU which has been passed by the iframe catalogue…
For example, it might be ‘https://ecommercesite.com/add-product?sku=12345’
I want to capture that ‘12345’ from the URL
I then want to pull the record from the database where the sku is 12345, and get the ID for that product, which could be ‘678’.
Once I’ve got the ID, I then need that same function to run the shortcode ‘add-to-cart?=678’
Is there a tutorial which will give me some insight into how to do this, or does anybody have any prior experience and can offer some advice?
Many thanks in advance
- The topic ‘Coding New Bridge Plugin – How To? Capture URL Variable / Trigger shortcode’ is closed to new replies.