Woocommerce BOGO
-
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)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Woocommerce BOGO’ is closed to new replies.