This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Rename product data tabs | |
| */ | |
| add_filter( 'woocommerce_product_tabs', 'woo_rename_tabs', 98 ); | |
| function woo_rename_tabs( $tabs ) { | |
| $tabs['description']['title'] = __( 'More Information' ); // Rename the description tab | |
| $tabs['reviews']['title'] = __( 'Ratings' ); // Rename the reviews tab | |
| $tabs['additional_information']['title'] = __( 'Product Data' ); // Rename the additional information tab |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Reorder product data tabs | |
| */ | |
| add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 ); | |
| function woo_reorder_tabs( $tabs ) { | |
| $tabs['reviews']['priority'] = 5; // Reviews first | |
| $tabs['description']['priority'] = 10; // Description second | |
| $tabs['additional_information']['priority'] = 15; // Additional information third |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Customize product data tabs | |
| */ | |
| add_filter( 'woocommerce_product_tabs', 'woo_custom_description_tab', 98 ); | |
| function woo_custom_description_tab( $tabs ) { | |
| $tabs['description']['callback'] = 'woo_custom_description_tab_content'; // Custom description callback | |
| return $tabs; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Check if product has attributes, dimensions or weight to override the call_user_func() expects parameter 1 to be a valid callback error when changing the additional tab | |
| */ | |
| add_filter( 'woocommerce_product_tabs', 'woo_rename_tabs', 98 ); | |
| function woo_rename_tabs( $tabs ) { | |
| global $product; | |
| if( $product->has_attributes() || $product->has_dimensions() || $product->has_weight() ) { // Check if product has attributes, dimensions or weight |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Add a custom product data tab | |
| */ | |
| add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' ); | |
| function woo_new_product_tab( $tabs ) { | |
| // Adds the new tab | |
| $tabs['test_tab'] = array( | |
| 'title' => __( 'New Product Tab', 'woocommerce' ), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Plugin Name: WooCommerce Integration Demo | |
| * Plugin URI: https://gist.github.com/BFTrick/091d55feaaef0c5341d8 | |
| * Description: A plugin demonstrating how to add a new WooCommerce integration. | |
| * Author: Patrick Rauland | |
| * Author URI: http://speakinginbytes.com/ | |
| * Version: 1.0 | |
| * | |
| * This program is free software: you can redistribute it and/or modify |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Auto Complete all WooCommerce orders. | |
| */ | |
| add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order' ); | |
| function custom_woocommerce_auto_complete_order( $order_id ) { | |
| if ( ! $order_id ) { | |
| return; | |
| } | |
| $order = wc_get_order( $order_id ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Create the section beneath the products tab | |
| **/ | |
| add_filter( 'woocommerce_get_sections_products', 'wcslider_add_section' ); | |
| function wcslider_add_section( $sections ) { | |
| $sections['wcslider'] = __( 'WC Slider', 'text-domain' ); | |
| return $sections; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Add settings to the specific section we created before | |
| */ | |
| add_filter( 'woocommerce_get_settings_products', 'wcslider_all_settings', 10, 2 ); | |
| function wcslider_all_settings( $settings, $current_section ) { | |
| /** | |
| * Check the current section is what we want | |
| **/ | |
| if ( $current_section == 'wcslider' ) { | |
| $settings_slider = array(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Add a message above the login / register form on my-account page | |
| */ | |
| add_action( 'woocommerce_before_customer_login_form', 'jk_login_message' ); | |
| function jk_login_message() { | |
| if ( get_option( 'woocommerce_enable_myaccount_registration' ) == 'yes' ) { | |
| ?> | |
| <div class="woocommerce-info"> | |
| <p><?php _e( 'Returning customers login. New users register for next time so you can:' ); ?></p> | |
| <ul> |