Instantly share code, notes, and snippets.

View woocommerce-ulozenka-variable-symbol.php
<?php
add_filter( 'ulozenka_variable', 'ulozenka_10003_variable', 10, 2 );
function ulozenka_10003_variable( $order_number, $order ){
$vs = get_post_meta( $order->get_id(), 'custom_variable_symbol', true );
if( !empty( $vs ) ){ return $vs; }
return $order_number;
}
View woocommerce-ulozenka-order-number.php
<?php
add_filter( 'ulozenka_order_number', 'ulozenka_10002_order_number', 10, 2 );
function ulozenka_10002_order_number( $order_number, $order ){
return $order->get_id();
}
View woocommerce-ulozenka-label-filter.php
<?php
add_filter( 'ulozenka_dobirka_label', 'ulozenka_10001_custom_label' );
function ulozenka_10001_custom_label( $label ){
return 'Dobírka';
}
View change-woocommerce-product-type-programatically.php
<?php
$product_id = 111;
wp_remove_object_terms( $product_id, 'simple', 'product_type' );
wp_set_object_terms( $product_id, 'variable', 'product_type', true );
View woocommerce-get-my-account-endpoints.php
//Orders
wc_get_account_endpoint_url( get_option( 'woocommerce_myaccount_orders_endpoint', 'orders' ) );
//Downloads
wc_get_account_endpoint_url( get_option( 'woocommerce_myaccount_downloads_endpoint', 'downloads' ) );
//Edit Address
wc_get_account_endpoint_url( get_option( 'woocommerce_myaccount_edit_address_endpoint', 'edit-address' ) );
//Payment Methods
View dummy-theme-chapter-3-searchform.php
<form method="get" id="searchform" action="<?php echo home_url(); ?>/">
<fieldset>
<input type="text" name="s" id="s" placeholder="<?php _e('Search...', 'theme') ?>" />
<input type="submit" name="submit" value="Search" id="s-submit">
</fieldset>
</form>