Answer the question
In order to leave comments, you need to log in
What should an AJAX request look like?
The store has a coupon removal using ajax and the remove_coupon( ) function. But when adding a coupon, the page reloads. Looked at the documentation and found the apply_coupon( ) function there. Can you please tell me how the ajax request to this function should look like?
Answer the question
In order to leave comments, you need to log in
Maybe I didn't fully understand, but it seems easier to put this plugin, which allows you to add a coupon by making a get request, without calling the function directly.
EXAMPLE: APPLY COUPON VIA AN URL
Apply coupon through an url like this:
Use the url www.example.com/url-to-shop?apply_coupon=my_coupon
Voila! Any coupon can be applied this way.
$.ajax({
type: 'GET',
headers: {
},
url: "www.example.com/url-to-shop?apply_coupon=my_coupon",
data: {},
response: 'text',
success: function(data){}
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question