<?php $urlpage = $_SERVER['REQUEST_URI']; ?>
<?php $navesi = '/navesi/'; ?>
<?php $lestnitsy = '/lestnitsy/'; ?>
<!-- endlist -->
<?php if (strpos($urlpage, 'navesi')): ?>
<?php include 'navesi.php' ?>
<?php elseif (strpos($urlpage, 'lestnitsy')): ?>
<?php include 'lestnitsy.php' ?>
<?php else : ?>
<?php endif; ?>
function my_woocommerce_update_product( $id ) {
$product = wc_get_product( $id );
$already_set = get_post_meta( $id, '_set_default_price', true );
$price = $product->get_price();
//
//
if ( $price == "0" ) {
$postinfo = get_field('group-select');
$postid = get_field('id_groups_products');
//
$highprice = get_field('high-price', $postid);
$defaultprice = get_field('default-price', $postid);
$smallprice = get_field('small-price', $postid);
//
if( get_field('group-select') == 'high' ):
$product->set_regular_price( $highprice );
$product->save();
endif;
if( get_field('group-select') == 'default' ):
$product->set_regular_price( $defaultprice );
$product->save();
endif;
if( get_field('group-select') == 'small' ):
$product->set_regular_price( $smallprice );
$product->save();
endif;
update_post_meta( $id, '_set_default_price', 'yes' );
}
}
add_action( 'woocommerce_update_product', 'my_woocommerce_update_product' );