WooCommerce共46篇 第2页

在WooCommerce中,订单状态改变的钩子

在WooCommerce中,有一个订单状态改变的钩子,这个钩子叫做:woocommerce_order_status_changed。 这个钩子有很大的用途,像网上那些积分插件、分销插件,底层就是这个钩子处理订单的。或者你还...
KEKC的头像-KEKC博客KEKC1个月前
010710

woocommerce货币操作

相关源码文件地址: /wp-content/plugins/woocommerce/includes/wc-core-functions.php 1、更改货币符号 在woocommerce中,有的货币符号会导致辨识度问题,比如人民币和日元、加元和美元,单单...
KEKC的头像-KEKC博客KEKC6个月前
011210

woocommerce结账页国家排序

结账页国家排序 //结账页国家排序 add_filter( 'woocommerce_countries_allowed_countries', 'sdf_countries_order', 99999, 1 ); function sdf_countries_order( $countries ) { $new_countrie...
KEKC的头像-KEKC博客KEKC10个月前
979

woocommerce订单结账后执行操作

订单结账后发送邮箱: /** * Send an email each time an order with coupon(s) is completed * The email contains coupon(s) used during checkout process * */ function woo_email_order_co...
KEKC的头像-KEKC博客KEKC12个月前
899

WooCommerce新建一个运输方式

代码来源官网: <?php /* Plugin Name: Your Shipping plugin Plugin URI: https://woocommerce.com/ Description: Your shipping method plugin Version: 1.0.0 Author: WooThemes Author U...
KEKC的头像-KEKC博客KEKC12个月前
769

批量设置文章描述

以批量修改产品excerpt为例: $all_products = get_posts( array( 'post_type' => 'product', 'product_cat' => 'torso-doll', 'numberposts' => -1, 'post_status' => 'publish', 'post_excerp...
KEKC的头像-KEKC博客KEKC9个月前
1128
woocommerce自定义产品的选项卡-KEKC博客

woocommerce自定义产品的选项卡

在woocommerce的选项卡中,有一个过滤钩子,可以用这个钩子添加、修改、删除、排序我们的产品tabs选项卡。 添加(默认的代码): 可以看到,添加就是添加一个数组,在里面添加名称、排序、回调...
KEKC的头像-KEKC博客KEKC12个月前
1788

从数据库中删除所有WooCommerce产品

php代码: <?php require dirname(__FILE__).'/wp-blog-header.php'; $wpdb->query('DELETE FROM wp_terms WHERE term_id IN (SELECT term_id FROM wp_term_taxonomy WHERE taxonomy LIKE 'p...
KEKC的头像-KEKC博客KEKC12个月前
1098

WooCommerce中的优惠券类型

WooCommerce中默认有三种优惠券类型。 固定金额折扣(Fixed Cart Discount):按固定金额减免订单总金额。 百分比折扣(Percentage Discount):按订单总金额的一定百分比减免金额。 固定金额折...
KEKC的头像-KEKC博客KEKC2个月前
01158
WooCommerce根据Tag实现增加运费-KEKC博客

WooCommerce根据Tag实现增加运费

有时候我们的运费可能并不是根据地区来设置多少运费,可能根据的是产品本身的属性统一进行设置费用,往往某一类产品单独增加费用,只借助地区的话无法达到这样的效果。 所以我就想到根据Tag设置...
KEKC的头像-KEKC博客KEKC2个月前
0887

WooCommerce在结账页、购物车中显示产品图片

代码如下: // 结账页产品图片显示 add_filter( 'woocommerce_cart_item_name', 'product_thumbnail_in_checkout', 20, 3 ); function product_thumbnail_in_checkout( $product_name, $cart_it...
KEKC的头像-KEKC博客KEKC3个月前
0507

WooCommerce实现商品浏览历史纪录

原理是访问产品时往浏览器中写入Cookies,再通过Cookies存储的产品ID写成短代码展现,最后通过调用短代码实现显示产品。 代码如下,亲测可用: add_action( 'template_redirect', 'bbloomer_tra...
KEKC的头像-KEKC博客KEKC3个月前
0637

WooCommerce动作钩子woocommerce_after_checkout_validation失效

WooCommerce新版块状结账页(checkout)已将请求由wc-ajax转变为wp-json,这使得woocommerce_after_checkout_validation一众钩子彻底失效,我在使用时发现已无法使用,切换为经典页面时又能继续...
KEKC的头像-KEKC博客KEKC1个月前
0486

使用Golang检查woocommence产品图库是否超过大小

可以批量跑出存在大于某个大小产品图库的所有产品ID,也可以调整下输出,处理图片或者再写个压缩的函数进行压缩。实际测试跑5000多个产品,21秒钟跑完了,速度很快。 代码: package main impor...
KEKC的头像-KEKC博客KEKC6个月前
0966

woocommerce修改使用的模板

add_filter('wc_get_template_part','change_checkout_order_received_template',10,3); function change_checkout_order_received_template($template, $slug, $name){ if($slug == 'checkout/...
KEKC的头像-KEKC博客KEKC10个月前
1225
批量追加Woocommerce产品的属性值-KEKC博客

批量追加Woocommerce产品的属性值

公司在前期并未增加任何产品的属性值,用了标签,但是现在想增加属性值这样就能使用属性在侧边筛选出产品。于是我写了一套程序,可以自动追加产品属性,目前是按照分类的slug进行操作的,你也可...
KEKC的头像-KEKC博客KEKC5个月前
0645

复制WooCommerce订单发货地址到剪贴板上

<?php /* Plugin Name: Copy WooCommerce order shipping address to clipboard Plugin URI: https://www.damiencarbery.com/2022/11/copy-woocommerce-order-shipping-address-to-clipboard...
KEKC的头像-KEKC博客KEKC12个月前
755

WooCommerce支付方式(支付网关)开发

官方文档:支付网关API - WooCommerce 示例插件代码1: <?php /** * Plugin Name: WooCommerce Invoice Gateway * Plugin URI: * Description: Clones the 'Cheque' gateway to create anoth...
KEKC的头像-KEKC博客KEKC12个月前
1805

WooCommerce批量修改属性价格

WooCommerce的属性价格存储在post meta表中,key为属性的slug,value是属性值。注意key是有前缀的,为attribute_pa__slug。比如我们要批量更改所有产品中body-type为wm-164cm-j-cup-as-image的...
KEKC的头像-KEKC博客KEKC1个月前
0584

woocommerce在产品卡片下增加内容

我这里以添加发布日期为例: 方法有很多,我是直接修改的价格显示 add_filter('woocommerce_get_price_html',function($html){//添加时间显示 if (in_the_loop()) { $html = $html.'<br>'.th...
KEKC的头像-KEKC博客KEKC7个月前
0834
WooCommerce显示计划优惠倒计时-KEKC博客

WooCommerce显示计划优惠倒计时

在WooCommerce中,可以设置计划优惠,从开始到结束日期享受一定优惠,但是默认的却不显示优惠时间倒计时,于是我决定研究一下。写出了下面的代码: add_filter('woocommerce_get_price_html',fu...
KEKC的头像-KEKC博客KEKC3个月前
0934