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
jQuery(document).ready(function ( $ ) { | |
$( 'button.load_customer_billing' ).off( 'click' ); | |
$( 'button.load_customer_billing' ).on( 'click', function() { | |
if ( window.confirm( woocommerce_admin_meta_boxes.load_billing ) ) { | |
// Get user ID to load data for | |
var user_id = $( '#customer_user' ).val(); | |
if ( ! user_id ) { | |
window.alert( woocommerce_admin_meta_boxes.no_customer_selected ); |
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
function wcs_redirect_product_based ( $order_id ){ | |
$order = wc_get_order( $order_id ); | |
foreach( $order->get_items() as $item ) { | |
$_product = wc_get_product( $item['product_id'] ); | |
// Add whatever product id you want below here | |
if ( $item['product_id'] == 70 ) { | |
// change below to the URL that you want to send your customer to | |
wp_redirect('http://www.yoururl.com/your-thank-you-page'); | |
} |
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
/** | |
* Register term fields | |
*/ | |
add_action( 'init', 'register_vendor_custom_fields' ); | |
function register_vendor_custom_fields() { | |
add_action( WC_PRODUCT_VENDORS_TAXONOMY . '_add_form_fields', 'add_vendor_custom_fields' ); | |
add_action( WC_PRODUCT_VENDORS_TAXONOMY . '_edit_form_fields', 'edit_vendor_custom_fields', 10 ); | |
add_action( 'edited_' . WC_PRODUCT_VENDORS_TAXONOMY, 'save_vendor_custom_fields' ); | |
add_action( 'created_' . WC_PRODUCT_VENDORS_TAXONOMY, 'save_vendor_custom_fields' ); | |
} |
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
remove_action( 'woocommerce_proceed_to_checkout', 'woocommerce_button_proceed_to_checkout', 20 ); | |
add_action( 'woocommerce_proceed_to_checkout', 'change_url_to_checkout', 20 ); | |
function change_url_to_checkout() { | |
$cart = WC()->cart->get_cart(); | |
$url = ''; | |
foreach ( $cart as $item ) { | |
if ( $item['product_id'] === 70 ) { | |
$url = 'put_your_extra_page_url_here'; | |
break; |
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
/** | |
* Redirect to a specific page when clicking on Continue Shopping in the single product page | |
* | |
* @return void | |
*/ | |
function wc_custom_redirect_continue_shopping( $message ) { | |
if ( strpos( $message, __( 'View Cart', 'woocommerce' ) ) !== false ) { | |
$message = str_replace( esc_url( wc_get_page_permalink( 'cart' ) ), esc_url( wc_get_page_permalink( 'shop' ) ), $message ); | |
$message = str_replace( __( 'View Cart', 'woocommerce' ), esc_html__( 'Continue Shopping', 'woocommerce' ), $message ); |
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
/** | |
* Hide shipping rates when free shipping is available. | |
* Updated to support WooCommerce 2.6 Shipping Zones. | |
* | |
* @param array $rates Array of rates found for the package. | |
* @return array | |
*/ | |
function my_hide_shipping_when_free_is_available( $rates ) { | |
$free = array(); | |
foreach ( $rates as $rate_id => $rate ) { |
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 | |
/** | |
* Dokan Seller registration form | |
* | |
* @since 2.4 | |
* | |
* @package dokan | |
*/ | |
?> |
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
// remove the filter | |
remove_filter( 'woocommerce_process_registration_errors', 'dokan_seller_registration_errors' ); | |
remove_filter( 'registration_errors', 'dokan_seller_registration_errors' ); | |
// New registration form erros handling | |
function dokan_update_seller_registration_errors( $error ) { | |
$allowed_roles = apply_filters( 'dokan_register_user_role', array( 'customer', 'seller' ) ); | |
// is the role name allowed or user is trying to manipulate? | |
if ( isset( $_POST['role'] ) && !in_array( $_POST['role'], $allowed_roles ) ) { |
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 | |
/** | |
* Add and update custom field through Action Hook in registration form. Paste this code in the functions.php . You should create action hook "wpuf_registration_form_hook" in the registration field. | |
* | |
* @param int $form_id | |
* @param null|int $user_id | |
* @param array $form_settings | |
*/ | |
function render_registration_form_hook( $form_id, $user_id, $form_settings ) { |
OlderNewer