• Resolved Kay

    (@kaylynnejohnson)


    Hi there,

    I am having a weird issue with your plugin. Everything is working fine, except the gift certificate is always sent to the admin rather than the email entered in the “to” field!

    Please let me know how I can fix this.

    I will send you an email with my website credentials.

    Thanks!

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

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

    (@pimwick)

    Hello,

    I did a quick test and your site is using an AJAX add-to-cart that isn’t compatible with the gift card product. Most AJAX add-to-cart options will pull the full form data just like WooCommerce does, however you can see that the To / From / Message fields are not displaying in the Cart prior to checkout.

    A quick solution is to disable the AJAX add-to-cart option for your site. Less drastic is to disable it per-product.

    We have encountered this with a couple of other themes in the past, you could try one of these two code snippets to see if it helps in your situation.

    Follow these steps to make the Add-to-cart process work correctly for the PW Gift Card product type.

    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:

    // Added by Pimwick, LLC ([email protected])
    // Disable the AJAX add-to-cart for the PW Gift Cards product since it
    // does not correctly add the fields to the cart item data.
    function pimwick_et_option_ajax_addtocart( $value ) {
        global $product;
    
        if ( is_a( $product, 'WC_Product_PW_Gift_Card' ) ) {
            return false;
        }
    
        return $value;
    }
    add_filter( 'et_option_ajax_addtocart', 'pimwick_et_option_ajax_addtocart' );

    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.

    If that code doesn’t change anything, try this instead:

    // Added by Pimwick, LLC ([email protected])
    // Disable the sticky cart for the PW Gift Cards product since it
    // does not correctly show the fields on the main page.
    function pw_gift_cards_disable_wc_sticky_cart( $value ) {
        global $product;
    
        if ( is_a( $product, 'WC_Product_PW_Gift_Card' ) ) {
            return 1;
        }
    
        return $value;
    }
    add_filter( 'theme_mod_disable_wc_sticky_cart', 'pw_gift_cards_disable_wc_sticky_cart' );

    Let me know if you have any questions!

    Thread Starter Kay

    (@kaylynnejohnson)

    Thanks a lot for your fast reply! I will try it on my end and let you know if everything works fine.

    Same issue here. The gift card email will not go to the “To” field in the gift card product. They’re all sent to my admin email instead. I’ve tried both of you recommendations, Pimwick, but neither worked for me.

    Plugin Author pimwick

    (@pimwick)

    Do you see the To / From / Message fields on the product page?

    If so, when you add the product to your cart does it retain and show those values?

    If you send me the URL I’ll look and see if anything jumps out. It will email the admin when there is no recipient.

    Thread Starter Kay

    (@kaylynnejohnson)

    Hi there,

    I added the code, but the problem persists. I will send you website credentials in an email.

    Plugin Author pimwick

    (@pimwick)

    Marking this ticket as resolved after correspondence with Kay.

    Hello, I’m having the same issue, can you please tell me what the fix was?

    Plugin Author pimwick

    (@pimwick)

    The issue is with AJAX add-to-cart theme or plugin. It isn’t including the addition FORM fields which means there is no To / From / Message being added to the user’s Cart session.

    Due to a web host issue we weren’t able to access the files for the original poster. However, if you contact your theme developer and request instructions on how to bypass the AJAX add-to-cart for specific products, this will resolve your issue.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Gift card always sending to site admin’ is closed to new replies.