• Resolved haffy

    (@haffy)


    HI,
    I have now supported two tickets to Woocommerce BOGO (Buy one get one) support with multiple days between, and I don?t get any answers. Now my deadline nears.

    I want to add custom text to the cart and to the order confirmation email. Like, “This one is for free”. So the order people clearly see that that line is free.

    I have tried to add this to the “set_free_price” function in the “class-wc-bogof-cart.php” file. And various code in my “functions.php”.

       
    // THIS
    public function add_on_display_cart() {
      echo '<p>This one is free.</p>';
    }
    
    public function add_on_display_emails( $fields ) {
      echo '<p>This one is free.</p>';
    }
    // -------
    
    /**
    * Set product price to zero.
    *
    * @param WC_Product $product Product object.
    * @param string     $cart_rule_id Cart rule ID.
    */
    
    private static function set_free_price( &$product, $cart_rule_id ) {
      $product->set_price( 0 );
      $product->set_sale_price( 0 );
      $product->_bogof_free_item = $cart_rule_id;
    
    // THIS
      add_filter( 'woocommerce_get_item_data', 'add_on_display_cart', 10, 2 );
      add_filter( 'woocommerce_email_order_meta_fields', 'add_on_display_emails' );
    // -------
    }
    
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support B C. a11n

    (@battouly)

    Hi @haffy,

    Please contact us at WooCommerce.com > My Account > Support. We don’t provide support for Premium plugins in the WooCommerce Forum.

    You may need to create an account before you can access that page.

    Please include a link to this forum thread, so that we can keep track of what’s already been done.

    We will be able to help you further there.

    Thread Starter haffy

    (@haffy)

    I have done that already, twice. But with my professional account.. I will do it again now.

    Thread Starter haffy

    (@haffy)

    Were back here.

    Is there anyone that can help me with this? Is there a hook I can hook up the text to for the email confirmation?

    Thread Starter haffy

    (@haffy)

    Got it to work.

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