Mike Jolley on "[Plugin: WooCommerce] Link to product variation on order received page"

ساخت وبلاگ

Sorry to bother you again Mike, but for some reason I can't get the URL working elsewhere on the thankyou page - although it shows the ordered products. Probably it is something stupid I'm forgetting or so - any help would be appreciated.

What I've done so far:
1. Made a copy of my thankyou.php in my child theme
2. Included the following code at the place where I wanted it to show up:

<?php if ( sizeof( $order->get_items() ) > 0 ) { foreach( $order->get_items() as $item ) { } }
?>
<?php
if ( ! apply_filters( 'woocommerce_order_item_visible', true, $item ) ) { retu; }
$is_visible = $product && $product->is_visible();
$product_permalink = apply_filters( 'woocommerce_order_item_permalink', $is_visible ? $product->get_permalink( $item ) : '', $item, $order );
echo apply_filters( 'woocommerce_order_item_name', $product_permalink ? sprintf( '<a href="%s">%s</a>', $product_permalink, $item['name'] ) : $item['name'], $item, $is_visible );
?>

3. I know this is still the original edited (by you) echo as a test, but this is only showing the name of the product ordered and there is no link behind the product.
In the end I only want to show the actual URL with a link of the same URL behind it, so probably like this:

$product->get_permalink( $item ) : '', $item, $order );
echo apply_filters( 'woocommerce_order_item_name', $product_permalink ? sprintf( '<a href="%s">%s</a>', $product_permalink, $product_permalink, $item, $is_visible );

When I look in the source code it only retus the name of the product and not the etc. So the problem seems that I can't get the URL to show up here.

WordPress ...
ما را در سایت WordPress دنبال می کنید

برچسب : نویسنده : استخدام کار wpss بازدید : 217 تاريخ : سه شنبه 28 ارديبهشت 1395 ساعت: 18:25