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_action( 'woocommerce_email_header', 'add_email_header', 20 ); | |
function add_email_header() { | |
echo '<h2>My Heading</h2>'; | |
echo '<p>Add content here</p>'; | |
} |
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
{ | |
"product": { | |
"title": "Premium Quality", | |
"type": "simple", | |
"regular_price": "21.99", | |
"description": "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.", | |
"short_description": "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.", | |
"categories": [ | |
9, | |
14 |
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
{ | |
"product": { | |
"stock_quantity": 2 | |
} | |
} |
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
{ | |
"product": { | |
"title": "Premium Quality", | |
"id": 3487, | |
"created_at": "2017-11-09T06:20:05Z", | |
"updated_at": "2017-11-09T06:20:05Z", | |
"type": "simple", | |
"status": "publish", | |
"downloadable": false, | |
"virtual": false, |
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_filter( 'body_class', 'add_preorder_class' ); | |
add_filter( 'post_class', 'add_preorder_class' ); | |
function add_preorder_class( $classes ) { | |
global $post; | |
$product = wc_get_product( $post->ID ); | |
if ( $product && 'yes' === get_post_meta( $product->get_id(), '_wc_pre_orders_enabled', true ) ) { | |
$classes[] = 'pre-order'; | |
} |
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 | |
function wc_pdf_watermark_extend_template_tags( $parsed_text, $unparsed_text, $order, $product ) { | |
// Look for {product_title} in text and replace it with the product title | |
$parsed_text = str_replace( '{product_title}', $product->get_title(), $parsed_text ); | |
return $parsed_text; | |
} | |
add_filter( 'woocommerce_pdf_watermark_parse_template_tags', 'wc_pdf_watermark_extend_template_tags', 10, 4 ); |
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 | |
/** | |
* Sets the product default price to 10. Only works once, if the price is not specified. | |
* | |
* @param int $post_id | |
* @param object $post | |
*/ | |
function set_product_default_price( $post_id, $post ) { | |
$product = wc_get_product( $post_id ); | |
$already_set = get_post_meta( $post_id, '_set_default_price', true ); |
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 | |
/** | |
* Display the theme credit | |
* | |
* @since 1.0.0 | |
* @return void | |
*/ | |
function storefront_credit() { | |
?> | |
<div class="site-info"> |
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_action( 'init', 'custom_init', 999 ); | |
function custom_init() { | |
$order = wc_get_order( 123 ); | |
$order->set_payment_method_title( 'Credit Card' ); | |
} |
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_filter( 'woocommerce_get_script_data', 'my_strength_meter_custom_strings', 10, 2 ); | |
function my_strength_meter_custom_strings( $data, $handle ) { | |
if ( 'wc-password-strength-meter' === $handle ) { | |
$data_new = array( | |
'i18n_password_error' => esc_attr__( 'Come on, enter a stronger password.', 'theme-domain' ), | |
'i18n_password_hint' => esc_attr__( 'The password should be at least seven characters long.', 'theme-domain' ) | |
); | |
$data = array_merge( $data, $data_new ); | |
} |