This is the most simplest way of adding a product to the cart with a custom price. The price is not changing, what am I doing wrong? You may have restricted the product or all products from being able to add the product to cart with a custom price. Or you have set a salt […]
Articles
Articles for CoCart
Categories: Developer (1) · Getting Started (1) · Questions (15) · Requesting support from us (9) · Snippets (9) · WP-CLI (1)
Allow specific products to override the price
Using the filter cocart_is_allowed_to_override_price, you can run through a loop of product ID’s to return the statement as true for them only and return false for every other product your not checking. This will allow you to only override the price of those products and no other.
How to update items in cart in bulk
With the new update cart callback system in place you can now update the quantity of items in the cart in bulk. Simply pass the item key and the quantity for each item you wish to change and the quantity of those items will update.
Disable decimals in money response
Code snippet is included.
Can I install/update CoCart via Composer?
Yes. The best method would be to install/update CoCart from the GitHub repository but you can also do so via https://wpackagist.org/
Why CoCart and not WooCommerce Store API?
WooCommerce Store API is limited and designed mainly to focus on their Gutenberg blocks they have developed in React.