ACF - Display custom created field in woocommerce order details page - php

Need help in displaying a custom field i created in ACF, into woocommerce order details. anyone any idea?
I'm clueless in creating the function into functions.php in my theme editor

Related

Woocommerce Product Grid/List View

Hi is there a way to enable List View in a Woocommerce theme?
from the link provided below, only the Grid View works. The List View seem inactive.
Thanks.
https://prnt.sc/wljg1d

How do I display a custom checkout field on my custom page within the Wordpress dashboard?

I am using the Checkout Field Editor for WooCommerce plugin on a wordpress site to add custom fields to the Woocommerce checkout page.
They appear normally, all right, they also appear normally on the orders page within the Woocommerce panel itself.
What I want is:
I have a custom page that I am making inside the panel to display display all orders (I need this page for my project).
In it I am able to get all the data for each order, using the code below. How can I get the value of the custom field I created using the plugin mentioned above? Is there a possibility?
Below is the code I am using on this page to obtain the information for each order.
$order_id = $order->get_id();
$billing_country = $order->get_billing_country();
$billing_first_name = $order->get_billing_first_name()

Woo-commerce product filter is not displaying using shortcode

Currently i am trying to display woo-commerce product filter using short-code [woocommerce_product_filter] but it's nothing display only showing text of short-code.
I have used same short-code in admin page and my custom template.
Custom template display short code.
<?php echo do_shortcode("[woocommerce_product_filter]"); ?>
I got reference link for display product filter from here
Can anyone suggest me how can i display product filter of woo-commerce in my custom template.

Unable to display custom fields on archived-product.php WooCommerce Wordpress

I have this problem about my WordPress integration. My problem starts when I start customizing the woo commerce plugin. I make some custom fields using ACF Plugin. My problem is I am not able to display such custom fields on the archived-product.php.
archived-product.php is the shop page right ? But after making some custom fields and point it to ( page == shop ) and calling the custom field with the following code:
<?php the_field('top_image_banner_sub_pages'); ?>
The custom field is still not visible on the archived-product.php. My question is how do I call my custom field so that it would be visible in my shop field ? Your answers are highly appreciated. Thanks a lot Sir/Mam.
Using ACF for this page is a fine idea. I think your problem is your fields are on your "Shop" page, but in actuality the Shop page that WooCommerce is rendering is not associated with the Shop page ID.
The page that is loading is 'archived-product.php' as you mentioned. So you need to tell ACF exactly where to look by entering the ID of your page. So your code should look like this:
<?php the_field('top_image_banner_sub_pages', 123); ?>
Where 123 is replaced by the ID of your Shop page.
Dont use Acf for product custom fields.. please use custom fields of wordpress.
For add meta
https://codex.wordpress.org/Function_Reference/add_post_meta
For get meta
https://codex.wordpress.org/Function_Reference/get_post_meta

How to display user's WooCommerce subscription details?

I have created a custom page template and I want to display specific details of user's subscription (e.g. subscription starting date).
The available hook on 'my account' page displays this but I don't know how to dismantle the output of the hook or even merely displaying it on a page template.
Any help would be appreciated!
Add the following code in functions.php of the active theme.
add_shortcode('wdm_my_subscription', 'wmd_my_custom_function');
function wmd_my_custom_function(){
WC_Subscriptions::get_my_subscriptions_template();
}
Now use [wdm_my_subscription] as a shortcode on the page where you want to display the User's subscription.
Screenshots:
Without Shortcode:
Adding shortcode:
Result:
If you need to modify the output of this you might need to copy the contains of get_my_subscriptions_template() function WC_Subscriptions class of the WooCommerce subscription Plugin and use it in this shortcode instead which will help you to add the details you want.
After a recent update in the Woocommerce Subscriptions plugin in WordPress
WC_Subscriptions::get_my_subscriptions_template(); is appreciated and it is replaced by new function,
so the old code needs to be updated and the following code needs to be used to create Shortcode to show users subscription
new function should be
add_shortcode('wdm_my_subscription', 'wmd_my_custom_function');
function wmd_my_custom_function(){
WCS_Template_Loader::get_my_subscriptions();
}

Categories