{"id":94427,"date":"2018-11-23T10:01:58","date_gmt":"2018-11-23T10:01:58","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/magic-coupon\/"},"modified":"2025-06-14T09:46:44","modified_gmt":"2025-06-14T09:46:44","slug":"magic-coupon","status":"publish","type":"plugin","link":"https:\/\/lmo.wordpress.org\/plugins\/magic-coupon\/","author":13328421,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"2.1","stable_tag":"2.1","tested":"6.9.4","requires":"5.8","requires_php":"7.2","requires_plugins":null,"header_name":"Magic URL Coupon for WooCommerce","header_author":"Naked Cat Plugins (by Webdados)","header_description":"Pass a WooCommerce coupon code via URL and display the product prices as if the coupon has been applied to them. Coupon is automatically added to the cart alongside the products.","assets_banners_color":"d06e13","last_updated":"2025-06-14 09:46:44","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"","header_author_uri":"https:\/\/nakedcatplugins.com","rating":5,"author_block_rating":0,"active_installs":90,"downloads":3669,"num_ratings":2,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":{"1.0":{"tag":"1.0","author":"webdados","date":"2018-11-23 11:54:09"},"1.0.1":{"tag":"1.0.1","author":"webdados","date":"2018-11-23 13:21:56"},"1.0.2":{"tag":"1.0.2","author":"webdados","date":"2019-11-05 16:29:11"},"1.1":{"tag":"1.1","author":"webdados","date":"2020-05-04 15:56:00"},"1.1.1":{"tag":"1.1.1","author":"webdados","date":"2020-05-04 16:08:26"},"1.2":{"tag":"1.2","author":"webdados","date":"2020-05-09 11:07:54"},"1.2.1":{"tag":"1.2.1","author":"webdados","date":"2020-05-09 12:21:04"},"1.2.2":{"tag":"1.2.2","author":"webdados","date":"2020-05-09 13:09:48"},"1.2.3":{"tag":"1.2.3","author":"webdados","date":"2020-05-10 08:21:33"},"1.2.3.1":{"tag":"1.2.3.1","author":"webdados","date":"2020-05-10 08:44:46"},"1.3":{"tag":"1.3","author":"webdados","date":"2020-05-10 12:49:59"},"1.3.1":{"tag":"1.3.1","author":"webdados","date":"2020-05-10 13:16:47"},"1.4":{"tag":"1.4","author":"webdados","date":"2020-05-17 17:25:55"},"1.5":{"tag":"1.5","author":"webdados","date":"2020-08-06 11:21:13"},"1.6":{"tag":"1.6","author":"webdados","date":"2020-09-10 13:01:16"},"1.7":{"tag":"1.7","author":"webdados","date":"2021-02-11 12:42:34"},"1.8":{"tag":"1.8","author":"webdados","date":"2022-06-29 15:47:38"},"1.9":{"tag":"1.9","author":"webdados","date":"2023-07-07 18:22:11"},"2.0":{"tag":"2.0","author":"webdados","date":"2023-12-13 17:33:26"},"2.1":{"tag":"2.1","author":"nakedcatplugins","date":"2025-06-14 09:46:44"}},"upgrade_notice":[],"ratings":{"1":0,"2":0,"3":0,"4":0,"5":"2"},"assets_icons":{"icon.svg":{"filename":"icon.svg","revision":1979513,"resolution":false,"location":"assets","locale":false}},"assets_banners":{"banner-1544x500.jpg":{"filename":"banner-1544x500.jpg","revision":3311434,"resolution":"1544x500","location":"assets","locale":""},"banner-772x250.jpg":{"filename":"banner-772x250.jpg","revision":3311434,"resolution":"772x250","location":"assets","locale":""}},"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0","1.0.1","1.0.2","1.1","1.1.1","1.2","1.2.1","1.2.2","1.2.3","1.2.3.1","1.3","1.3.1","1.4","1.5","1.6","1.7","1.8","1.9","2.0","2.1"],"block_files":[],"assets_screenshots":{"screenshot-1.png":{"filename":"screenshot-1.png","revision":1979426,"resolution":"1","location":"assets","locale":""}},"screenshots":{"1":"Magic coupon settings"},"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[591,456,2649,286],"plugin_category":[45,55],"plugin_contributors":[240703,78419],"plugin_business_model":[],"class_list":["post-94427","plugin","type-plugin","status-publish","hentry","plugin_tags-coupons","plugin_tags-marketing","plugin_tags-promotions","plugin_tags-woocommerce","plugin_category-ecommerce","plugin_category-seo-and-marketing","plugin_contributors-nakedcatplugins","plugin_contributors-webdados","plugin_committers-nakedcatplugins","plugin_committers-webdados","plugin_support_reps-nakedcatplugins","plugin_support_reps-ptwooplugins","plugin_support_reps-webdados"],"banners":{"banner":"https:\/\/ps.w.org\/magic-coupon\/assets\/banner-772x250.jpg?rev=3311434","banner_2x":"https:\/\/ps.w.org\/magic-coupon\/assets\/banner-1544x500.jpg?rev=3311434","banner_rtl":false,"banner_2x_rtl":false},"icons":{"svg":"https:\/\/ps.w.org\/magic-coupon\/assets\/icon.svg?rev=1979513","icon":"https:\/\/ps.w.org\/magic-coupon\/assets\/icon.svg?rev=1979513","icon_2x":false,"generated":false},"screenshots":[{"src":"https:\/\/ps.w.org\/magic-coupon\/assets\/screenshot-1.png?rev=1979426","caption":"Magic coupon settings"}],"raw_content":"<!--section=description-->\n<p>With this plugin, you can pass a coupon code via an URL parameter (<code>mcoupon<\/code> by default) and it will be stored in a cookie for a configurable amount of time.<\/p>\n\n<p>While the cookie is valid:<\/p>\n\n<ul>\n<li>All the eligible products will have their display price reflect the coupon discount;<\/li>\n<li>A personalized HTML message can be shown on the product page, under the product price (or anywhere else, if you know your way around hooks);<\/li>\n<li>When the client adds the product to the cart, the coupon is automatically applied also;<\/li>\n<\/ul>\n\n<p>Please note that the coupon can still be applied manually by the user at any time. This will not lock the coupon regular usage.<\/p>\n\n<p>The support for variable products is experimental and may be moved to a premium add-on in the future.<\/p>\n\n<h4>Other (premium) plugins<\/h4>\n\n<p>Already know our other WooCommerce (premium) plugins?<\/p>\n\n<ul>\n<li><a href=\"https:\/\/nakedcatplugins.com\/product\/shop-as-client-for-woocommerce-pro-add-on\/\">Shop as Client for WooCommerce<\/a> - Quickly create orders on behalf of your customers<\/li>\n<li><a href=\"https:\/\/nakedcatplugins.com\/product\/taxonomy-term-and-role-based-discounts-for-woocommerce-pro-add-on\/\">Taxonomy\/Term and Role based Discounts for WooCommerce<\/a> - Easily create bulk discount rules for products based on any taxonomy terms (built-in or custom)<\/li>\n<li><a href=\"https:\/\/nakedcatplugins.com\/product\/simple-woocommerce-order-approval\/\">Simple WooCommerce Order Approval<\/a> - The hassle-free solution for WooCommerce order approval before payment<\/li>\n<\/ul>\n\n<!--section=installation-->\n<ul>\n<li>Use the included automatic install feature on your WordPress admin panel and search for \u201cMagic URL Coupon WooCommerce\u201d;<\/li>\n<li>On each coupon you want to activate this plugin features, you must go to the \u201cMagic coupon\u201d tab and check \u201cEnable\u201d;<\/li>\n<\/ul>\n\n<!--section=faq-->\n<dl>\n<dt id='can%20i%20change%20the%20url%20parameter%20name%20from%20%60mcoupon%60%20to%20something%20else%3F'><h3>Can I change the URL parameter name from `mcoupon` to something else?<\/h3><\/dt>\n<dd><p>Yes. Use the <code>magic_coupon_url_parameter<\/code> filter.<\/p><\/dd>\n<dt id='can%20i%20show%20the%20html%20message%20somewhere%20else%20on%20the%20product%20page%3F'><h3>Can I show the HTML message somewhere else on the product page?<\/h3><\/dt>\n<dd><p>Sure you can. Use the <code>magic_coupon_html_message_action_hook<\/code> filter to change the hook and the <code>magic_coupon_html_message_action_priority<\/code> filter to change the priority.<\/p>\n\n<p>If you don\u2019t know what we\u2019re talking about, you should probably stop now and <a href=\"https:\/\/www.webdados.pt\/contactos\/\">hire us<\/a> to do it for you :-)<\/p>\n\n<p>You can also show it directly on the product description by using the <code>[magic_coupon_html_message]<\/code> shortcode.<\/p><\/dd>\n<dt id='is%20it%20possible%20to%20add%20dynamic%20information%20to%20the%20html%20message%3F'><h3>Is it possible to add dynamic information to the HTML message?<\/h3><\/dt>\n<dd><p>You bet! Use one of the following placeholders on your message:<\/p>\n\n<ul>\n<li><code>{product_id}<\/code> will be replaced by the Product ID;<\/li>\n<li><code>{coupon}<\/code> will be replaced by the coupon code;<\/li>\n<li><code>{cookie_expire_timestamp}<\/code> will be replaced by the cookie expiration Unix timestamp;<\/li>\n<li><code>{cookie_validity_minutes}<\/code> will be replaced by the cookie validity in minutes;<\/li>\n<li><code>{cookie_validity_hours_minutes}<\/code> will be replaced by the cookie validity in hours or minutes (in the <code>x hours<\/code> or <code>x minutes<\/code> format), depending on the validity being more or less than one hour;<\/li>\n<\/ul>\n\n<p>You can also add you own placeholders with the <code>magic_coupon_html_message_replace_tags<\/code> filter. See an example <a href=\"https:\/\/gist.github.com\/webdados\/c6094429e1e53306d767ee0b7255f4ea\">here<\/a>.<\/p>\n\n<p>And because you can also use shortcodes on the HTML message field, you can feed the product id, coupon, the cookie expire timestamp or validity, or any other variable you set via your own placeholders as a shortcode argument, you can do whatever you want with your custom message. <a href=\"https:\/\/gist.github.com\/webdados\/57682c9f7e4dad416f1ab0ec4b7476d5\">Go crazy<\/a>, or <a href=\"https:\/\/www.webdados.pt\/contactos\/\">hire us<\/a> to develop a custom solution for you.<\/p><\/dd>\n<dt id='can%20this%20plugin%20have%20issues%20with%20caching%20plugins%3F'><h3>Can this plugin have issues with caching plugins?<\/h3><\/dt>\n<dd><p>Yes. The page output has to be changed to set the discounted product prices based on the user cookie. That\u2019s incompatible with a server-side caching system.<\/p>\n\n<p>We set the following constants to prevent caching by some plugins, on the moment the customer reaches the page with a coupon code:<\/p>\n\n<ul>\n<li><code>DONOTCACHEPAGE<\/code><\/li>\n<li><code>DONOTCACHEOBJECT<\/code><\/li>\n<li><code>DONOTCACHEDB<\/code><\/li>\n<\/ul>\n\n<p>This will ensure the page with the discounted price is not cached on that moment (and no other users will see a version of the page with the discount), but will not disable the cache that might already exist.<\/p>\n\n<p>Anyway, we've experimented a bit with the <a href=\"https:\/\/wordpress.org\/plugins\/wp-optimize\/\">WP-Optimize<\/a> \u201cCookies which, if present, will prevent caching\u201d setting, by entering the name of our cookie (<code>mcoupon<\/code> by default), and we had good results. Regular users see the cached page and the ones with the coupon set on the cookie see non-cached pages.<\/p><\/dd>\n<dt id='is%20this%20plugin%20compatible%20with%20the%20new%20woocommerce%20high-performance%20order%20storage%3F'><h3>Is this plugin compatible with the new WooCommerce High-Performance Order Storage?<\/h3><\/dt>\n<dd><p>Yes.<\/p><\/dd>\n<dt id='is%20this%20plugin%20compatible%20with%20the%20new%20woocommerce%20block-based%20cart%20and%20checkout%3F'><h3>Is this plugin compatible with the new WooCommerce block-based Cart and Checkout?<\/h3><\/dt>\n<dd><p>Yes.<\/p><\/dd>\n<dt id='i%20need%20help%2C%20can%20i%20get%20technical%20support%3F'><h3>I need help, can I get technical support?<\/h3><\/dt>\n<dd><p>This is a free plugin. It\u2019s our way of giving back to the wonderful WordPress community.<\/p>\n\n<p>There\u2019s a support tab on the top of this page, where you can ask the community for help. We\u2019ll try to keep an eye on the forums but we cannot promise to answer support tickets.<\/p>\n\n<p>If you reach us by email or any other direct contact means, we\u2019ll assume you need, premium, and of course, paid-for support.<\/p><\/dd>\n<dt id='where%20do%20i%20report%20security%20vulnerabilities%20found%20in%20this%20plugin%3F'><h3>Where do I report security vulnerabilities found in this plugin?<\/h3><\/dt>\n<dd><p>You can report any security bugs found in the source code of this plugin through the <a href=\"https:\/\/patchstack.com\/database\/vdp\/magic-coupon\">Patchstack Vulnerability Disclosure Program<\/a>. The Patchstack team will assist you with verification, CVE assignment and take care of notifying the developers of this plugin.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>2.1 - 2025-06-14<\/h4>\n\n<ul>\n<li>[NEW] We are now called Naked Cat Plugins \ud83d\ude3b<\/li>\n<li>[FIX] Copy coupon URL was submitting the coupon form on the backend<\/li>\n<li>[DEV] Apply WordPress Coding Standards<\/li>\n<li>[DEV] Requires WordPress 5.8, WooCommerce 7.1 and PHP 7.2<\/li>\n<li>[DEV] Tested with WordPress 6.9-alpha-60301 and WooCommerce 9.9.3<\/li>\n<\/ul>\n\n<h4>2.0 - 2023-12-13<\/h4>\n\n<ul>\n<li>Beta compatibility with Subscription Products (not variable) and the \"Recurring Product Discount\" and \"Recurring Product % Discount\" coupon types<\/li>\n<li>Declare WooCommerce block-based Cart and Checkout compatibility<\/li>\n<li>Requires WordPress 5.4<\/li>\n<li>Tested with WordPress 6.5-alpha-57159 and WooCommerce 8.4.0<\/li>\n<\/ul>\n\n<h4>1.9 - 2023-07-07<\/h4>\n\n<ul>\n<li>Requires WooCommerce 5.0<\/li>\n<li>Tested with WordPress 6.3-beta3-56143 and WooCommerce 7.9.0-rc.3<\/li>\n<\/ul>\n\n<h4>1.8 - 2022-06-29<\/h4>\n\n<ul>\n<li>New brand: PT Woo Plugins \ud83e\udd73<\/li>\n<li>Requires WordPress 5.0, WooCommerce 3.0 and PHP 7.0<\/li>\n<li>Tested with WordPress 6.1-alpha-53556 and WooCommerce 6.7.0-beta.2<\/li>\n<\/ul>\n\n<h4>1.7<\/h4>\n\n<ul>\n<li>Compatibility with \u201cPercentage Coupon per Product for WooCommerce\u201d 0.6 (experimental, sponsored by <a href=\"https:\/\/masterswiss.com\/\">https:\/\/masterswiss.com\/<\/a>)<\/li>\n<li>Tested with WordPress 5.7-beta2-50285 and WooCommerce 5.0<\/li>\n<\/ul>\n\n<h4>1.6<\/h4>\n\n<ul>\n<li>New filter on the \"is on sale\" own function for better <a href=\"https:\/\/wordpress.org\/plugins\/product-percentage-coupon-woo\/\">Percentage Coupon per Product for WooCommerce<\/a> integration (sponsored by: <a href=\"https:\/\/masterswiss.com\/\">Master Swiss<\/a>)<\/li>\n<li>Tested with WordPress 5.6-alpha-48937 and WooCommerce 4.5.1<\/li>\n<\/ul>\n\n<h4>1.5<\/h4>\n\n<ul>\n<li>Compatibility with our upcoming plugin \u201cPercentage Coupon per Product for WooCommerce\u201d plugin<\/li>\n<li>Tested with WordPress 5.5-RC1-48708 and WooCommerce 4.4.0-rc.1<\/li>\n<\/ul>\n\n<h4>1.4<\/h4>\n\n<ul>\n<li>Show discount prices on <a href=\"https:\/\/wordpress.org\/plugins\/tier-pricing-table\/\">WooCommerce Tiered Price Table<\/a> (sponsored by: <a href=\"https:\/\/masterswiss.com\/\">Master Swiss<\/a>)<\/li>\n<\/ul>\n\n<h4>1.3.1<\/h4>\n\n<ul>\n<li>Bugfix on categories inclusion\/exclusion for variable products<\/li>\n<li>Fix PHP notice when product has no price<\/li>\n<\/ul>\n\n<h4>1.3<\/h4>\n\n<ul>\n<li>Experimental support for variable products (may be moved to a premium add-on in the future)<\/li>\n<li>Check if coupon needs to be applied when cart quantities are updated (thanks <a href=\"https:\/\/usomascara.pt\">UsoMascara.pt<\/a>)<\/li>\n<li>Code refactor for flexibility<\/li>\n<\/ul>\n\n<h4>1.2.3.1<\/h4>\n\n<ul>\n<li>Plugin name changed from \u201cMagic Coupon for WooCommerce\u201d to \u201cMagic URL Coupon for WooCommerce\u201d<\/li>\n<\/ul>\n\n<h4>1.2.3<\/h4>\n\n<ul>\n<li>Better UX on the \u201cMagic coupon\u201d tab, including a button to copy the shop URL with the coupon parameter on it<\/li>\n<li>Technical support clarification<\/li>\n<\/ul>\n\n<h4>1.2.2<\/h4>\n\n<ul>\n<li>Fix small bug displaying the sale price when the discount value was below 1 (thanks <a href=\"https:\/\/produtoslimpeza.pt\">ProdutosLimpeza.pt<\/a>)<\/li>\n<\/ul>\n\n<h4>1.2.1<\/h4>\n\n<ul>\n<li>Fix PHP notice when the discount is neither \u201cPercentage discount\u201d or \u201cFixed product discount\u201d (thanks @alordiel)<\/li>\n<\/ul>\n\n<h4>1.2<\/h4>\n\n<ul>\n<li>New <code>{cookie_validity_hours_minutes}<\/code> placeholder on the HTML message that will show the cookie validity time in hours or minutes; <\/li>\n<li>Some fixes on the way the coupon is added to the cart to ensure it only happens after the product is already there<\/li>\n<li>Avoid duplicating the discount on the cart and checkout pages (Oops...)<\/li>\n<\/ul>\n\n<h4>1.1.1<\/h4>\n\n<ul>\n<li>Small bugfix<\/li>\n<\/ul>\n\n<h4>1.1<\/h4>\n\n<ul>\n<li>New <code>[magic_coupon_html_message]<\/code> shortcode to show the HTML message on the product description if the theme is custom and does not call the <code>woocommerce_single_product_summary<\/code> action<\/li>\n<li>Bugfix on the moment the coupon is checked from the cookie to avoid errors on some configurations<\/li>\n<li>Clarification of operation in conjunction with cache plugins<\/li>\n<li>Tested with WordPress 5.5-alpha-47748 and WooCommerce 4.1.0-rc.2<\/li>\n<\/ul>\n\n<h4>1.0.2<\/h4>\n\n<ul>\n<li>Tested with WordPress 5.2.5-alpha and WooCommerce 3.8.0<\/li>\n<\/ul>\n\n<h4>1.0.1<\/h4>\n\n<ul>\n<li>Small readme.txt fixes<\/li>\n<\/ul>\n\n<h4>1.0<\/h4>\n\n<ul>\n<li>First released version (sponsored by: <a href=\"http:\/\/muchogrowth.com\">muchogrowth.com<\/a>)<\/li>\n<\/ul>","raw_excerpt":"Pass a WooCommerce coupon code via URL and display the product prices as if the coupon has been applied to them. Coupon is automatically added to the  &hellip;","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/94427","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=94427"}],"author":[{"embeddable":true,"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/webdados"}],"wp:attachment":[{"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=94427"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=94427"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=94427"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=94427"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=94427"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=94427"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}