I created a function to add a drop-down field before payment info at checkout page.
The following is working when i tried the add_action
function.
add_action('woocommerce_review_order_before_payment', 'add_store_selection');
function add_store_selection() {
$content .= '<div id="store-pickup-select">';
$content .= '<select><option selected="selected">Choose one</option>';
/* Here i will get a list of option value from another function */
$content .= '</select>';
$content .= '</div>';
echo $content;
}
But what I need is I only want this drop-down to show when coupon code is applied. I remove the add_action('woocommerce_review_order_before_payment', 'add_store_selection');
Then I tried this:
function add_store_list() {
do_action( 'woocommerce_review_order_before_payment');
}
add_action( 'woocommerce_applied_coupon', 'add_store_list');
The drop-down list appeared on top of billing details, not the in woocommerce_review_order_before_payment
position
How can I make the drop-down appear at before payment section when coupon code is clicked?