I'm working on a new site and the customer, uses alot of cutom-discount-rules for their business. They want to make it so, their customer can se their price in their new webshop. How ever there are some problems.
We can make the rules just fine, how ever we cant delete the rules, though a hook or any thing, only the interface. We've been useing the dynamic rules to do this.
1. Is it possible to delete a rule - not csv or interface.
2. Is it poosible to update a rule, when we push it from C5 it makes a duplicate instead of overriteing the rule.
3. is it poosible to bach-update the rules? again not via CSV or interface.
At the end of all operations caches would need to be cleared.
2. Is it poosible to update a rule, when we push it from C5 it makes a duplicate instead of overriteing the rule.
With REST API, you would need to make your POST request to the specific endpoint of the existing rule, e.g.
yoursite.com/wp-json/wp/v2/b2bking_rule/1234 , where 1234 is the rule ID. (instead of using the general yoursite.com/wp-json/wp/v2/b2bking_rule endpoint).
Such a request would update the existing rule instead of creating a new one.
3. is it poosible to bach-update the rules? again not via CSV or interface.
How would this work ideally ? / using what?
4. Can se set a start and end date of a rule?
It is possible to set a start date, using the regular WP schedule post system, when you create the rule:
This should work and allow the rule to start working when the specified time is reached.
Hi,
I'm working on a new site and the customer, uses alot of cutom-discount-rules for their business. They want to make it so, their customer can se their price in their new webshop. How ever there are some problems.
We can make the rules just fine, how ever we cant delete the rules, though a hook or any thing, only the interface. We've been useing the dynamic rules to do this.
1. Is it possible to delete a rule - not csv or interface.
2. Is it poosible to update a rule, when we push it from C5 it makes a duplicate instead of overriteing the rule.
3. is it poosible to bach-update the rules? again not via CSV or interface.
4. Can se set a start and end date of a rule?
Hi Lasse,
Glad to assist,
1. Is it possible to delete a rule - not csv or interface.
How do you need to do it? I mean, are you working with PHP, or with the REST API, etc?
With PHP, we can do it with this code:
With REST API, instead of a POST request, you'd need to make a DELETE request to yoursite.com/wp-json/wp/v2/b2bking_rule/1234 , where 1234 is your rule's ID.
At the end of all operations caches would need to be cleared.
2. Is it poosible to update a rule, when we push it from C5 it makes a duplicate instead of overriteing the rule.
With REST API, you would need to make your POST request to the specific endpoint of the existing rule, e.g.
yoursite.com/wp-json/wp/v2/b2bking_rule/1234 , where 1234 is the rule ID. (instead of using the general yoursite.com/wp-json/wp/v2/b2bking_rule endpoint).
Such a request would update the existing rule instead of creating a new one.
3. is it poosible to bach-update the rules? again not via CSV or interface.
How would this work ideally ? / using what?
4. Can se set a start and end date of a rule?
It is possible to set a start date, using the regular WP schedule post system, when you create the rule:
This should work and allow the rule to start working when the specified time is reached.
To set an end date, there is no feature in the plugin, but you can use the Post Expirator plugin, as described in the guide here: https://woocommerce-b2b-plugin.com/docs/set-an-expiration-date-time-limit-for-discounts-offers/
Kind regards,
Stefan