Can I set a custom “alt” attribute with woocommerce_get_product_thumbnail()?

You can’t with woocommerce_get_product_thumbnail(), but this will give you the exact same result: global $product; $image_size = apply_filters( ‘single_product_archive_thumbnail_size’, ‘woocommerce_thumbnail’ ); $custom_alt=”Put your custom alt text here.”; return $product ? $product->get_image( $image_size, [ ‘alt’ => $custom_alt ] ) : ”;

Replace one coupon to another after coupon added

This requires to use an action hook like woocommerce_calculate_totals that is related to cart and Ajax enabled, because it will handle all changes made by the customer in cart page: add_action( ‘woocommerce_calculate_totals’, ‘discount_based_on_cart_subtotal’, 10, 1 ); function discount_based_on_cart_subtotal( $cart ) { if ( is_admin() && ! defined( ‘DOING_AJAX’ ) ) return; // Avoiding hook repetitions … Read more

Disabling the free shipping method when the cart has product/s which assigned a certain shipping class [closed]

Try this: function hide_shipping_methods( $available_shipping_methods, $package ) { $shipping_classes = array( ‘some-shipping-class-1’, ‘some-shipping-class-2’ ); $excluded_methods = array( ‘free_shipping’ ); $shipping_class_exists = false; foreach( $package[‘contents’] as $key => $value ) if ( in_array( $value[‘data’]->get_shipping_class(), $shipping_classes ) ) { $shipping_class_exists = true; break; } if ( $shipping_class_exists ) { $methods_to_exclude = array(); foreach( $available_shipping_methods as $method => … Read more

WooCommerce WebHook Retry

This seems to do the trick, it retries every 5 minutes and uses the built in woocommerce action name. <?php /* Plugin Name: Custom Stuff Description: Custom Functions, etc. */ // make sure woocommerce never disables a webhook function overrule_webhook_disable_limit($number) { return 999999999999; //very high number hopefully you’ll never reach. } add_filter(‘woocommerce_max_webhook_delivery_failures’, ‘overrule_webhook_disable_limit’); // add … Read more

How to update the WooCommerce cart Icon to show new products added with JavaScript

Heres a nice article describing how to do this, but a very different approach to yours : https://aceplugins.com/ajax-add-to-cart-button-on-the-product-page-woocommerce/ Since you know how many items are being added to the cart (1 based on your link) you could just fake some addition and upate the cart icon value Assuming the cart icon number has an id … Read more

Woocommerce: How to remove page title from storefront theme homepage

Try this: add_action( ‘wp’, ‘storefront_remove_title_from_home_homepage_template’ ); function storefront_remove_title_from_home_homepage_template() { remove_action( ‘storefront_homepage’, ‘storefront_homepage_header’, 10 ); } or if you use default template add_action( ‘wp’, ‘_storefront_remove_title_from_home_default_template’ ); function storefront_remove_title_from_home_default_template() { if ( is_front_page() ) remove_action( ‘storefront_page’, ‘storefront_page_header’, 10 ); }

WooCommerce Product Page css

You’ve actually done most of the work finding this by identifying the classes (good job!). All you then had to do was to grep the WooCommerce code for those two – and you’ll find them both in templates/single-product/product-attributes.php. So all you need to do to restructure the table is to override the single-product/product-attributes.php template and … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)