When I paste the code below directly into the thankyou.php
, it works perfectly fine. but when I try to hook it into woocommerce_thankyou
, nothing happens.
I'm just getting started with PHP,
add_action('woocommerce_thankyou', 'test_1', 10, 1);
function test_1() {
$paymethod = $order->payment_method_title;
$orderstat = $order->get_status();
if (($orderstat == 'completed') && ($paymethod == 'PayPal')) {
echo "something";
} elseif (($orderstat == 'processing') && ($paymethod == 'PayPal')) {
echo "some other shit";
} elseif (($orderstat == 'pending') && ($paymethod == 'PayPal')) {
echo "some other shit";
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…