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_before_main_content', 'bbloomer_loop_cat_slug' ); | |
function bbloomer_loop_cat_slug() { | |
if ( is_product_category( 'books' ) ) { | |
echo 'This will show on the Books Cat page'; | |
} elseif ( is_product_category( 'chairs' ) ) { | |
echo 'This will show on the Chairs Cat page'; | |
} | |
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_before_main_content', 'bbloomer_loop_tag' ); | |
function bbloomer_loop_tag() { | |
if ( is_product_tag() ) { | |
echo 'This will show on every Cat pages'; | |
} else { | |
echo 'This will show on all other Woo pages'; | |
} | |
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_before_main_content', 'bbloomer_loop_tag_slug' ); | |
function bbloomer_loop_tag_slug() { | |
if ( is_product_tag( 'red' ) ) { | |
echo 'This will show on the Red Tag page'; | |
} elseif ( is_product_tag( 'yellow' ) ) { | |
echo 'This will show on the Yellow Tag page'; | |
} | |
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_before_main_content', 'bbloomer_woo_page' ); | |
function bbloomer_woo_page() { | |
if ( is_woocommerce() ) { | |
echo 'This will show on Woo pages'; | |
} else { | |
echo 'This will show on WP pages'; | |
} | |
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_sidebar', 'bbloomer_cart_checkout' ); | |
function bbloomer_cart_checkout() { | |
if ( is_cart() ) { | |
echo 'This will show on the Cart sidebar'; | |
} elseif ( is_checkout() ) { | |
echo 'This will show on the Checkout sidebar'; | |
} | |
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
function bbloomer_find_id_in_cart() { | |
foreach ( WC()->get_cart() as $cart_item_key => $values) { | |
$product = $values['data']; | |
if ( $product->get_id() == 123 ) { | |
// do something | |
} | |
} |
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
Адрес: | |
[pods name="company-info" slug="company-address"]{@company-address}[/pods] | |
Режим работы: | |
[pods name="company-info" slug="company-time"]{@company-time}[/pods] | |
Телефон: | |
[pods name="company-info" slug="company-phone"]{@company-phone}[/pods] | |
Электронная почта: |
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
/* ========== Получаем информацию о компании со страницы настроек ==========*/ | |
function get_company_details() | |
{ | |
$pod = pods('company-info'); | |
$fields = array( | |
'company-phone' => $pod-> field('company-phone'), | |
'company-email' => $pod-> field('company-email'), | |
'company-time' => $pod-> field('company-time'), | |
); |
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
/* Выводим категории над списком товаров */ | |
function woocommerce_product_category( $args = array() ) { | |
$woocommerce_category_id = get_queried_object_id(); | |
$args = array( | |
'parent' => $woocommerce_category_id | |
); | |
$terms = get_terms( 'product_cat', $args ); | |
if ( is_product_category() ) { | |
if ( $terms ) { | |
echo '<ul class="woocommerce-categories">'; |
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
/** | |
* Бейдж "Бесплатная доставка" для товаров от 1000 руб. | |
*/ | |
add_action( 'woocommerce_before_shop_loop_item_title', 'usota_show_free_shipping_badge' ); | |
function usota_show_free_shipping_badge() { | |
global $post, $product; | |
if ( $product && $product->get_price() >= 1000 ) { | |
echo '<span class="free-shipping">FREE</span>'; | |
} |