Is there a Woocommerce hook that fires when applying a coupon but before checking if it’s valid?

Its the woocommerce_get_shop_coupon_data filter, example code: add_filter ( ‘woocommerce_get_shop_coupon_data’, ‘mp_create_coupon’, 10, 2 ); function mp_create_coupon( $data, $code ) { // Check if the coupon has already been created in the database global $wpdb; $sql = $wpdb->prepare( “SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_type=”shop_coupon” AND post_status=”publish” ORDER BY post_date DESC LIMIT 1;”, $code … Read more

Editing Header Titles of each details in woocommerce Order Email [closed]

To change the heading that appears in the body (message) of the email template you can use the following filter: ‘woocommerce_email_heading_’ . $this->id where $this->id equates to the id class property that is set within the email class of the specified type. For example, to change the heading of the “New Order” email you would … Read more

WooCommerce: display text instead of raw checkbox value email

Try this instead: add_action( “woocommerce_email_after_order_table”, “my_woocommerce_email_after_order_table”, 10, 1); function my_woocommerce_email_after_order_table( $order ) { $my_gift_wrap_checkbox = get_post_meta( $order->id, “my_gift_wrap_checkbox”, true ); $gift_wrap = $my_gift_wrap_checkbox ? ‘Yes please!’ : ‘No thank you.’; echo ‘<p><strong>Gift wrap?: </strong>’ . $gift_wrap . ‘</p>’; if ( $my_gift_wrap_checkbox ) { echo ‘<p><strong>Gift wrap instructions: </strong>’ . get_post_meta( $order->id, “my_gift_wrap_field”, true ) . … Read more

Custom Redirect after registration in WooCommerce

Internally, WooCommerce uses WordPress’ wp_safe_redirect() which does not allow redirects to external hosts. In order to get around this, we must add our desired host to the whitelist. The whitelist can be modified using the allowed_redirect_hosts which has been demonstrated below: /** * Adds example.com to the list of allowed hosts when redirecting using wp_safe_redirect() … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)