Support » Plugin: PW WooCommerce Gift Cards » Cannot purchase anymore

  • Resolved yosikrivo

    (@yosikrivo)


    Hello,
    Thanks for great plugin.

    I created a gift card product and made some test purchases, but now I cannot purchase more, it looks as if inventory is 0 (as regular product)
    Please advise.
    Thanks,
    Yosi

    The page I need help with: [log in to see the link]

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

    (@pimwick)

    See if this works. Follow these instructions to force the Gift Cards to be purchasable:

    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 custom_woocommerce_variation_is_purchasable( $is_purchasable, $variation ) {
        if ( ! $is_purchasable ) {
            $product_id = $variation->get_parent_id();
            $parent_product = wc_get_product( $product_id );
            if ( is_a( $parent_product, 'WC_Product_PW_Gift_Card' ) ) {
                $is_purchasable = true;
            }
        }
    
        return $is_purchasable;
    }
    add_filter( 'woocommerce_variation_is_purchasable', 'custom_woocommerce_variation_is_purchasable', 9999, 2 );

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

    If you have any problems, replace functions.php with your backup file.

    Let me know if you have any questions!

    Thread Starter yosikrivo

    (@yosikrivo)

    Hi Dear,

    Thanks for your support but No, it doesn’t work.

    Yosi

    Thread Starter yosikrivo

    (@yosikrivo)

    Hi,

    Thanks, meantime I deleted the product and added a new one and it seems to work fine.(without the code you have sent me)
    If the problem occur again i will contact you again.

    Again, Thanks for your great plugin.
    Yosi

    Plugin Author pimwick

    (@pimwick)

    Glad to hear you got it sorted out, let me know if there is anything else you need help with!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Cannot purchase anymore’ is closed to new replies.