how to scrolling image on single product page

You simply need to set a height of the containing element that contain the image. And then set that element in css to overflow-y: scroll in the css. Just basic. Then your image will be shown using scroll.. More specifically for woocommerce .. you can set this css to your style.css .product-images{overflow-y:scroll; background:url(yourimageurl) no-repeat; width:widthof … Read more

I want hide view more button if price is blank

Instead of eliminating the loop/add-to-cart.php template all together, why not hook into the price html Woocommerce hooks? /* * Remove price HTML if stock is null * * Sources: * http://woocommerce.wp-a2z.org/oik_api/wc_productget_stock_quantity/ */ add_filter( “woocommerce_get_price_html”, “wphelpsanjay_remove_price_if_no_stock”, 10, 2 ); add_filter( “woocommerce_variable_price_html”, “wphelpsanjay_remove_price_if_no_stock”, 10, 2 ); function wphelpsanjay_remove_price_if_no_stock( $price, $product ) { if ( null === $product->get_stock_quantity()) … Read more

Grandchild Term Things Grandfather Term is It’s Parent

Use get_terms() and the parent argument. ‘parent’ (int|string) Parent term ID to retrieve direct-child terms of. $parent_term_id = 123; $direct_child_terms = get_terms( array( ‘taxonomy’ => ‘[taxonomy]’, ‘parent’ => $parent_term_id, ) ); Don’t forget to replace [taxonomy] with whatever the taxonomy is; e.g., post_tag, product_cat, etc. Additional arguments for further customization here.

Woocomerce pulling wrong time from server -5 hrs difference

For the date Woocommerce CODE function wc_string_to_datetime( $time_string ) { // Strings are defined in local WP timezone. Convert to UTC. if ( 1 === preg_match( ‘/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(Z|((-|\+)\d{2}:\d{2}))$/’, $time_string, $date_bits ) ) { $offset = ! empty( $date_bits[7] ) ? iso8601_timezone_to_offset( $date_bits[7] ) : wc_timezone_offset(); $timestamp = gmmktime( $date_bits[4], $date_bits[5], $date_bits[6], $date_bits[2], $date_bits[3], $date_bits[1] ) – … Read more

Override a Plugin Function

The following code is work around by using the filter in the code above and by returning an empty array. It is placed in functions.php of your theme. It’s not a ‘work around’. That’s the correct way to do it. But there is a shorter way to do the same thing. WordPress has a function … Read more

Hide one specific woocoomerce product

This code is tested and works fine on a fresh WP and WooCommerce installation. if ( !is_user_logged_in()) { function exclude_product_from_users($q){ $current_user = wp_get_current_user(); $prodcuts_ids = array(648); $q->set( ‘post__not_in’, $prodcuts_ids ); } add_action( ‘woocommerce_product_query’, ‘exclude_product_from_users’ ); function return_from_product_page(){ global $post; $prodcuts_ids = array(648); if(in_array( $post->ID , $prodcuts_ids)){ wp_redirect(home_url(“https://wordpress.stackexchange.com/”)); exit(); } } add_action(‘wp’, ‘return_from_product_page’); }

How can I override wp_price woocommerce function in my theme

Hmm how about this? function return_custom_price($price, $product) { global $post, $blog_id; $price = get_post_meta($post->ID, ‘_regular_price’); $post_id = $post->ID; $price = ($price[0]*2.5); return $price; } add_filter(‘woocommerce_get_price’, ‘return_custom_price’, 10, 2); Taken from here:https://sceptermarketing.com/how-to-change-the-woocommerce-price-via-functions-php/