• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Payments Plugin for Stripe

Stripe payment plugins for your WordPress site

  • Home
  • Documentation
  • Addons
  • Login
    • Sign In
    • Edit Profile
    • Terms & Conditions
    • My Downloads
    • License Key
  • Support
    • Support Forum
    • Forum Search
    • Forum Login
    • Forum Registration
    • Email Support for Customers
  • Contact Us
  • Show Search
Hide Search
You are here: Home / Topics / Add coupon field into the link URL

[Resolved] Add coupon field into the link URL

· ·

Home › Forums › Stripe Payments Plugin › Add coupon field into the link URL

Tagged: coupon, payments, stripe

  • This topic has 5 replies, 4 voices, and was last updated 1 year, 5 months ago by Admin.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • October 15, 2020 at 7:21 am #3364
    uskutech
    Participant

    I can’t seem to find a way to add the coupon field into the link url (not the permalink)

    October 15, 2020 at 1:56 pm #3365
    alexanderfoxc
    Participant

    Hi.

    Coupons are not added to links, but rather to product itself.

    Perhaps you mean to add coupon field to a product generated by a shortcode? Please clarify.

    October 15, 2020 at 11:52 pm #3375
    Admin
    Keymaster

    Coupons are applied in the payment popup window. Check the following documentation:

    Creating Discount Coupons Using the Stripe Payments Plugin

    January 19, 2024 at 9:13 pm #5014
    Ai
    Participant

    I think the question is if we can add a coupon parameter to the link?
    e.g: /asp-payment-box/?product_id=133337&coupon_code=MY COUPONCODE

    January 20, 2024 at 12:47 am #5015
    Ai
    Participant

    Ok. Here is a workaround for anyone looking. Add the code snippet below to the file pp-handler.js located in FTP at:

    wp-content\plugins\stripe-payments\public\assets\js\pp-handler.js

    
    jQuery(document).ready(function(){
            var url = window.location.href;
            var name = 'coupon_code';
            var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(url);
            var thiscode = decodeURI(results[1]) || 0;
    		var couponcode = jQuery(document.getElementById("coupon-code")); 
    		var applycouponbtn = jQuery(document.getElementById("apply-coupon-btn"));
        
        
            var customfieldsdiv = jQuery(document.getElementById("custom-fields-cont"));   
            if(customfieldsdiv.length && customfieldsdiv.val().length){
             customfieldsdiv.prepend("<div class='pure-u-1'><legend>Customer Info</legend></div>");
            }
            couponcode.val(thiscode);
            
           setTimeout(function(){ 
        
            if(couponcode.length && couponcode.val().length){
               applycouponbtn.trigger("click"); 
            }
             
           }, 3000); 
        
        });
    
    

    Now just add the param to the end of your product link: &coupon_code=MYCOUPONCODEHERE

    And of course replace MYCOUPONCODEHERE with a working coupon code set inside of Stripe payment options.

    January 24, 2024 at 11:30 pm #5022
    Admin
    Keymaster

    Thank you. I will check it out also.

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Log In

Primary Sidebar

Featured Addons and Extensions

  • Subscription Payments Addon
  • Additional Custom Fields
  • Secure Downloads Addon
  • Apple Pay, Google Pay, Afterpay

Addon Bundle

Stripe Payments Addon Bundle

A Simple & Lightweight Plugin

Our Philosophy with the Plugin

Support Links

  • Support Forum
  • Support Contact

Search

Copyright © 2025 | Stripe Plugins | A member of the Tips and Tricks HQ family.