通过WooCommerce,我使用的是Traveler高级主题
我需要在旅游和酒店中停用(TAX),我正在尝试使用此代码:
add_filter( 'woocommerce_product_tax_class', 'wc_diff_rate_for_user', 1, 2 );function wc_diff_rate_for_user( $tax_class, $cart_item ) {
if ( is_admin() && ! defined( 'DOING_AJAX' ) )
return;
// Define HERE your targeted products IDs
$products_ids_arr = array(12 ,15, 24);
// Define HERE your targeted user roles
$users_role_arr = array('administrator', 'userrolename');
//Getting the current user data
$user_data = get_userdata(get_current_user_id());
foreach ($users_role_arr as $user_role)
if ( in_array( $user_role, $user_data->roles ) && in_array( $cart_item->id, $products_ids_arr ) ) {
$tax_class = 'Zero Rate';
break;
}
return …Run Code Online (Sandbox Code Playgroud) 我有这个代码的问题我会解释一下这是如何工作的,
这样的想法是,当悬停在tag(a)中时id="meal",通过(data-meal = "meal-14")中的一个更改图像...用几个词
预先确定的图像是meal-0.png,将鼠标悬停在a带有(data-meal = 14)的tag()中,用(meal-14.png)替换图像的url,
一切正常,我只有一个问题,就是当你停止盘旋时,不要回到预先确定的图像,它会停留在悬浮的图像中.应该回到图像meal-0.png.
<div class="imagen-hover" id="meal">
<img src="/public/tienda/meal-0.png" alt="">
</div>
<ul>
<li><a class="carne-a" data-meal="meal-14">14. Punta de Anca</a></li>
<li><a class="carne-a" data-meal="meal-16">16. Chata Angosta</a></li>
</ul>
jQuery(document).ready(function($) {
var path = "/public/images/";
$(".meal-a").on("mouseover", function() {
var meal = $(this).attr("data-meal") + ".png";
$("#meal img").attr("src", path + meal)
});
});
Run Code Online (Sandbox Code Playgroud)