Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save manidip/8362fbe85fad9a968ad2f4ce041216d0 to your computer and use it in GitHub Desktop.

Select an option

Save manidip/8362fbe85fad9a968ad2f4ce041216d0 to your computer and use it in GitHub Desktop.

Revisions

  1. @bekarice bekarice revised this gist Dec 27, 2014. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion edit-woocommerce-checkout-template.php
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,8 @@
    * Each of these samples can be used - note that you should pick one rather than add them all.
    *
    * How to use WC notices: https://github.com/woothemes/woocommerce/blob/master/includes/wc-notice-functions.php#L96
    */
    * Tutorial: http://www.skyverge.com/blog/edit-woocommerce-templates/
    **/

    /**
    * Add a content block after all notices, such as the login and coupon notices.
  2. @bekarice bekarice revised this gist Dec 3, 2014. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion edit-woocommerce-checkout-template.php
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@
    <?php
    /**
    * Each of these samples can be used - note that you should pick one rather than add them all.
    *
  3. @bekarice bekarice revised this gist Oct 17, 2014. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions edit-woocommerce-checkout-template.php
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    <?php
    /**
    * Each of these samples can be used - note that you should pick one rather than add them all.
    *
  4. @bekarice bekarice created this gist Oct 17, 2014.
    48 changes: 48 additions & 0 deletions edit-woocommerce-checkout-template.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,48 @@
    /**
    * Each of these samples can be used - note that you should pick one rather than add them all.
    *
    * How to use WC notices: https://github.com/woothemes/woocommerce/blob/master/includes/wc-notice-functions.php#L96
    */

    /**
    * Add a content block after all notices, such as the login and coupon notices.
    *
    * Reference: https://github.com/woothemes/woocommerce/blob/master/templates/checkout/form-checkout.php
    */
    add_action( 'woocommerce_before_checkout_form', 'skyverge_add_checkout_content', 12 );
    function skyverge_add_checkout_content() {
    echo 'This content that you can use to tell customers stuff. You could make it a div class="checkout-message" and style it if you wanted.';
    }


    /**
    * Add a content in a notice instead. Let's add it before other notices with a priority = 9
    *
    * Reference: https://github.com/woothemes/woocommerce/blob/master/templates/checkout/form-checkout.php
    */
    add_action( 'woocommerce_before_checkout_form', 'skyverge_add_checkout_success', 9 );
    function skyverge_add_checkout_success() {
    wc_print_notice( __( 'A success message with high priority.', 'woocommerce' ), 'success' );
    }


    /**
    * Add an info notice instead. Let's add it after other notices with priority = 11
    *
    * Reference: https://github.com/woothemes/woocommerce/blob/master/templates/checkout/form-checkout.php
    */
    add_action( 'woocommerce_before_checkout_form', 'skyverge_add_checkout_notice', 11 );
    function skyverge_add_checkout_notice() {
    wc_print_notice( __( 'A notice message instead.', 'woocommerce' ), 'notice' );
    }


    /**
    * Add add a notice before the payment form - let's use an eror notice. Could also use content, etc.
    *
    * Reference: https://github.com/woothemes/woocommerce/blob/master/templates/checkout/review-order.php
    */
    add_action( 'woocommerce_review_order_before_payment', 'skyverge_before_paying_notice' );
    function skyverge_before_paying_notice() {
    wc_print_notice( __( 'An error message.', 'woocommerce' ), 'error' );
    }