This file contains 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
/bin/echo "{md5}"`/bin/echo -n "password" | openssl dgst -binary -md5 | openssl enc -base64` |
This file contains 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_action( 'woocommerce_product_thumbnails'. 'your_custom_function' ); | |
function your_custom_function() { | |
?> | |
<img src="http://domain.com/image.jpg" title="Your title" alt="Your alt" /> | |
<?php | |
} |
This file contains 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 VAT and SSN fields to the checkout form | |
add_filter( 'woocommerce_checkout_fields' , 'custom_add_vat_ssn_fields' ); | |
function custom_add_vat_ssn_fields( $fields ) { | |
if ( ! isset( $fields['billing']['billing_vat'] ) ) { | |
$fields['billing']['billing_vat'] = array( | |
'label' => __( 'VAT', 'your-domain' ), | |
'placeholder' => _x( 'VAT', 'placeholder', 'your-domain' ), | |
'required' => true, //change to false if you do not need this field to be required | |
'class' => array( 'form-row-first' ) | |
); |
This file contains 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_filter( 'woocommerce_my_account_my_address_formatted_address', 'custom_my_account_my_address_formatted_address', 10, 3 ); | |
function custom_my_account_my_address_formatted_address( $fields, $customer_id, $type ) { | |
if ( $type == 'billing' ) { | |
$fields['vat'] = get_user_meta( $customer_id, 'billing_vat', true ); | |
$fields['ssn'] = get_user_meta( $customer_id, 'billing_ssn', true ); | |
} | |
return $fields; | |
} |
This file contains 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 VAT and SSN fields in billing address display | |
add_filter( 'woocommerce_order_formatted_billing_address', 'custom_add_vat_ssn_formatted_billing_address', 10, 2 ); | |
function custom_add_vat_ssn_formatted_billing_address( $fields, $order ) { | |
$fields['vat'] = $order->billing_vat; | |
$fields['ssn'] = $order->billing_ssn; | |
return $fields; | |
} | |
add_filter( 'woocommerce_admin_billing_fields', 'custom_admin_billing_fields' ); |
This file contains 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_action( 'admin_enqueue_scripts', 'enqueue_custom_wc_load_address_js' ); | |
function enqueue_custom_wc_load_address_js() { | |
wp_enqueue_script( 'custom-wc-load-address', untrailingslashit( get_template_directory_uri() ) . '/jquery.wc-custom.js', array( 'wc-admin-order-meta-boxes' ) ); | |
} |
This file contains 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
if ( is_numeric( $download['downloads_remaining'] ) ) | |
echo apply_filters( 'woocommerce_available_download_count', '' . sprintf( _n( '%s download remaining', '%s downloads remaining', $download['downloads_remaining'], 'woocommerce' ), $download['downloads_remaining'] ) . ' ', $download ); |
This file contains 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_action( 'template_redirect', 'wc_custom_redirect_after_purchase' ); | |
function wc_custom_redirect_after_purchase() { | |
global $wp; | |
if ( is_checkout() && ! empty( $wp->query_vars['order-received'] ) ) { | |
$order_id = absint( $wp->query_vars['order-received'] ); | |
wp_redirect( get_permalink( {PAGE_ID} ) . '?order=' . $order_id ); | |
exit; | |
} | |
} |
This file contains 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
$product_tags = wp_get_post_terms( $product->id, 'product_tag' ); | |
if ( ! empty( $product_tags ) ) { | |
foreach( $product_tags as $tag ) { | |
if ( $tag->slug === 'tag-slug' && ! is_user_logged_in() ) { | |
return; | |
} | |
} | |
} |
This file contains 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 the meta _transaction_id in the search fields. | |
* | |
* @param array $fields | |
* @return array | |
*/ | |
function wc_custom_order_filter_fields( $fields ) { | |
if ( ! in_array( '_transaction_id', $fields ) ) { | |
array_push( $fields, '_transaction_id' ); | |
} |
OlderNewer