我想获取所有 WooCommerce 订单状态的所有 slugs 和名称。我尝试了以下线程中的答案:Woocommerce 获取订单状态列表列表,但没有成功。
我使用最新的 woocommerce 版本。任何帮助表示赞赏。
我使用 Woocommerce,我需要根据其类型更改电子邮件标题,以便“customer-new-account.php”、“customer-processing-order.php”、“admin-new-order.php”(等等)...他们必须有不同的标题。
我刚刚在我的子模板中复制了 woocommerce“电子邮件”文件夹,现在我需要知道如何更改代码。
任何帮助表示赞赏。;-) 提前致谢。
我需要在前端Woocommerce注册表单页面中使用新的Google"no Captcha"reCaptcha.
我在</ head>标记之前插入了以下代码:
<script src='https://www.google.com/recaptcha/api.js'></script>
Run Code Online (Sandbox Code Playgroud)
以及文件"woocommerce\myaccount\form-login.php"中的一个内部表单选项卡:
<div class="g-recaptcha" data-sitekey="xxxxxxxxx MY ID xxxxxxxxx"></div>
Run Code Online (Sandbox Code Playgroud)
显然,"xxxxxxxxx MY ID xxxxxxxxx"是我的谷歌ID代码.
它显示了新的验证码盒,但如果我尝试注册新用户而不检查验证码,它不会停止注册过程并完成注册而不会出现错误.
我有一个变量产品,其分类"pa_size"属性设置有以下值:S | M | L | XL
如何使用外部PHP脚本为该产品添加变体?
提前致谢.
我使用以下代码:
$sku = 21333;
$size = 'S';
$stock = 2;
$price_a = 60;
$price_b = 30;
$product_parent = get_product_by_sku($sku);
$product = new WC_Product_Variable($product_parent->id);
$variations = $product->get_available_variations();
// First off all delete all variations
foreach($variations as $prod_variation) {
$metaid=mysql_query("SELECT meta_id FROM wp_postmeta WHERE post_id = ".$prod_variation['variation_id']);
while ($row = mysql_fetch_assoc($metaid)) {
mysql_query("DELETE FROM wp_postmeta WHERE meta_id = ".$row['meta_id']);
}
mysql_query("DELETE FROM wp_posts WHERE ID = ".$prod_variation['variation_id']);
}
// Now add new variation …Run Code Online (Sandbox Code Playgroud) 我有以下tcpdf代码:
<?php
require_once('config/lang/eng.php');
require_once('tcpdf.php');
// Extend the TCPDF class to create custom Header and Footer
class MYPDF extends TCPDF {
//Page header
public function Header() {
}
// Page footer
public function Footer() {
}
}
// create new PDF document
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Stimart');
$pdf->SetTitle('test');
$pdf->SetSubject('test');
$pdf->SetKeywords('test');
// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING);
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); …Run Code Online (Sandbox Code Playgroud) 有没有办法用save_post挂钩设置产品重量?
我有以下代码,但我不知道如何覆盖重量:
add_action( 'save_post', 'change_weight' );
function change_weight($post_id) {
$WC_Product = wc_get_product($post_id);
}
Run Code Online (Sandbox Code Playgroud)