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
<?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 | |
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 | |
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
{ | |
"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
{ | |
"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", | |
"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
<?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
add_action( 'init', 'remove_footer_checkout' ); | |
function remove_footer_checkout() { | |
if ( is_checkout() ) { | |
remove_action( 'storefront_footer', 'storefront_handheld_footer_bar', 999 ); | |
} | |
} |
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( 'booking_form_params', 'change_booking_form_params' ); | |
function change_booking_form_params( $params ) { | |
$params['i18n_date_unavailable' = 'This date is unavailable'; | |
$params['i18n_date_fully_booked'] = 'This date is fully booked and unavailable'; | |
$params['i18n_date_partially_booked'] = 'This date is partially booked - but bookings still remain'; | |
$params['i18n_date_available'] = 'This date is available'; | |
$params['i18n_start_date'] = 'Choose a Start Date'; | |
$params['i18n_end_date'] = 'Choose an End Date'; | |
$params['i18n_dates'] = 'Dates'; | |
$params['i18n_choose_options'] = 'Please select the options for your booking above first'; |