wordpress

Restrict payment gateways based on taxonomy terms in WooCommerce checkout

家住魔仙堡 提交于 2021-02-10 18:49:09
问题 In my WooCommerce store I want to restrict and show payment gateway(cheque) only if the product has particular product category with the category ID "266". Now I have this snippet but it does the opposite - it disabled the gateway on the checkout for particular product category: add_filter( 'woocommerce_available_payment_gateways', 'bbloomer_unset_gateway_by_category' ); function bbloomer_unset_gateway_by_category( $available_gateways ) { if ( is_admin() ) return $available_gateways; if ( !

wordpress add featured image below post title

十年热恋 提交于 2021-02-10 18:37:27
问题 I try to display a featured image below the blog-post title. actually my posts look like: WP-header post-title date | author | comments post content tag | category My goal is to get a full-sized-image (featured image) between post-title & date | author | comments Actually I am using a Corpo Theme. Any ideas? Best Regards 回答1: You can fetch featured image using following code and paste it after post-title which should be <?php the_title() ?> <?php if ( has_post_thumbnail()) { $large_image_url

wordpress add featured image below post title

假如想象 提交于 2021-02-10 18:29:28
问题 I try to display a featured image below the blog-post title. actually my posts look like: WP-header post-title date | author | comments post content tag | category My goal is to get a full-sized-image (featured image) between post-title & date | author | comments Actually I am using a Corpo Theme. Any ideas? Best Regards 回答1: You can fetch featured image using following code and paste it after post-title which should be <?php the_title() ?> <?php if ( has_post_thumbnail()) { $large_image_url

A non well formed numeric value encountered while using wc_price WooCommerce hook

给你一囗甜甜゛ 提交于 2021-02-10 17:38:04
问题 I have a simple function that used to work that I got online somewhere a few years back. It allows me to manually change the currency conversion rate for EUR (€, Euro). Problem now is this: Notice: A non well formed numeric value encountered in /wp-content/themes/theme/functions.php on line 82 Whereof the notice refers to this line: $new_price = $price * $conversion_rate; This is what I need help fixing. This is the complete code: function manual_currency_conversion( $price ) { $conversion

WooCommerce progressive quantity discount for specific product categories

烂漫一生 提交于 2021-02-10 15:56:51
问题 I was researching a method to give a progressive discount if you have more than 1 product in the cart. I found this thread and actually using this code: //Discount by Qty Product add_action( 'woocommerce_before_calculate_totals', 'quantity_based_pricing', 9999 ); function quantity_based_pricing( $cart ) { global $product; if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return; if ( did_action( 'woocommerce_before_calculate_totals' ) >= 2 ) return; // Define discount rules and thresholds and

Add a custom “Sale Price” column to admin products list in Woocommerce

那年仲夏 提交于 2021-02-10 15:56:08
问题 I am trying to add a Sale Price column to admin Products list in Woocommerce. Here is my code: add_filter( 'manage_edit-product_columns', 'onsale_product_column', 10); function onsale_product_column($columns){ $new_columns = []; foreach( $columns as $key => $column ){ $new_columns[$key] = $columns[$key]; if( $key == 'product_cat' ) { $new_columns['onsale'] = __( 'Sale Price','woocommerce'); } } return $new_columns; } add_action( 'manage_product_posts_custom_column', 'onsale_product_column

WooCommerce progressive quantity discount for specific product categories

余生长醉 提交于 2021-02-10 15:54:07
问题 I was researching a method to give a progressive discount if you have more than 1 product in the cart. I found this thread and actually using this code: //Discount by Qty Product add_action( 'woocommerce_before_calculate_totals', 'quantity_based_pricing', 9999 ); function quantity_based_pricing( $cart ) { global $product; if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return; if ( did_action( 'woocommerce_before_calculate_totals' ) >= 2 ) return; // Define discount rules and thresholds and

Change shipping method programmatically from existing WooCommerce order

余生颓废 提交于 2021-02-10 14:55:17
问题 My customers ar buying subscriptions through my woocommerce website. They receive the products each month but somethimes they want to change the shipping method. I don't find doc for doing it through php. I could change the values in post_meta , woocommerce_order_items and woocommerce_order_itemmeta but it's not a durable solution. 回答1: Here is the way to change an order "shipping" item programmatically for a new shipping method id (slug ) to be defined: // Here set your shipping method ID

Change shipping method programmatically from existing WooCommerce order

北慕城南 提交于 2021-02-10 14:53:48
问题 My customers ar buying subscriptions through my woocommerce website. They receive the products each month but somethimes they want to change the shipping method. I don't find doc for doing it through php. I could change the values in post_meta , woocommerce_order_items and woocommerce_order_itemmeta but it's not a durable solution. 回答1: Here is the way to change an order "shipping" item programmatically for a new shipping method id (slug ) to be defined: // Here set your shipping method ID

Adding Webp support to Revolution Slider

半腔热情 提交于 2021-02-10 14:52:28
问题 I want Revolution Slider to use webp images if there is any available but it has no support for webp. How can i make this work ? 回答1: Open /wp-content/plugins/revslider/includes/output.class.php in a text editor. Search for if($img_size !== 'full' && $cur_img_id !== false && !empty($cur_img_id)){ $_urlImage = wp_get_attachment_image_src($cur_img_id, $img_size); $urlImage = ($_urlImage !== false) ? $_urlImage[0] : $urlImage; } inside the function get_html_layer() . Add if ( !empty($urlImage) &