• Resolved inahaystack

    (@inahaystack)


    Hi,

    Can this plugin be used with WooCommerce subscription products?

    Can I set fixed prices for the gift card eg £10 (one month subscription), £30 (3 months subscription)

    In the drop down prices menu, instead of it saying only numbers, can I set it to say “£10 – one month subscription”?

    Thanks a lot,

    Kate

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author pimwick

    (@pimwick)

    The gift card won’t be tied to specific products, however you can change the label to indicate what the gift card can purchase. WooCommerce has a hook that you can use to change labels for the dropdown menu. It is called woocommerce_variation_option_name

    You could then map the current value to the name you want to see. For example:

    1. Download the functions.php from your FTP server at /wp-content/themes/<your theme>/functions.php
    2. Keep a backup of functions.php in case there are problems.
    3. Edit functions.php and scroll to the very end and add this code.

    Note: if the last line is “?>” then put this code *above* that line. Otherwise, this code goes at the very end of the file:

    function pw_gift_cards_woocommerce_variation_option_name( $name ) {
        global $product;
    
        if ( is_a( $product, 'WC_Product_PW_Gift_Card' ) ) {
            $map = array(
                '£10' => '£10 – one month subscription',
                '£30' => '£30 – one month subscription',
                '£120' => '£120 – one month subscription',
            );
    
            if ( isset( $map[$name] ) ) {
                return $map[$name];
            }
        }
    
        return $name;
    }
    add_filter( 'woocommerce_variation_option_name', 'pw_gift_cards_woocommerce_variation_option_name', 10, 2 );

    4. Save the functions.php file and re-upload it to your server.

    Replace functions.php with your backup file if you have any problems.

    The customer who receives the gift card can purchase a higher subscription and use another payment method to cover the difference.

    Thread Starter inahaystack

    (@inahaystack)

    Thank you! Will the gift card work with renewals or will it have to be applied manually each month?

    Plugin Author pimwick

    (@pimwick)

    We haven’t tested renewals, most likely it would need to be applied manually each month. The purchase of the subscription is a standard order though so the gift card balance would be applied to that purchase.

    Thread Starter inahaystack

    (@inahaystack)

    Thanks so much.

    Sorry, what do you mean by this “The purchase of the subscription is a standard order though so the gift card balance would be applied to that purchase.” Do you mean the gift card would be used on the first month when the subscription is originally bought?

    Do you know what would happen if the person with the gift card is already a subscriber?

    Plugin Author pimwick

    (@pimwick)

    The gift card can be used for the initial purchase. Renewals would need to be done manually since we did not code any direct integration with the WooCommerce Subscriptions plugin.

    We have plans to fully test integration with the subscriptions but at the moment we don’t have that data so I can’t say for sure. I recommend installing our plugin on a test site along with the subscriptions plugin. You can then see if it meets your needs.

    The open source version of our plugin (the one hosted here on www.ads-software.com) operates fundamentally the same as our Pro version, so if the plugin meets your needs and you decide you need the Pro features you won’t have to reevaluate the plugin.

    Plugin Author pimwick

    (@pimwick)

    Marking this thread as resolved but if there is anything further you need help with just let us know.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Use with subscription products’ is closed to new replies.