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();
}
Related
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()
So i'm working with WordPress and WooCommerce for a website and i have a task that i don't know how to solve. When i create a WooCommerce product i need another landing page for that product to be created automatically where i can see details of the product and similar products.
I was trying to use wp_insert_post() but i can't figure it out how to add the page after adding a product
Is there a way i can do that or is there a plugin that gives you the function to do that?
I hope i was clear in the question.
Thank you in advance
You could try to use the WordPress save_post action: https://codex.wordpress.org/Plugin_API/Action_Reference/save_post
On saving a post, check if the post type is Woocommerce's product post type. If true, you can do whatever you want :)
i am struggling with magento add custom function for checkout method.
how to get popup messages after click the "onepage-guest-register-button" in checkout method.Also need to send email to the vendor with the selected product id in magento.
I am new in magento,any one please help to me.
Thanks,
You can customize login template here:
[Magento root]/app/design/frontend/[your theme package]/[your theme]/template/persistent/checkout/onepage/login.phtml
or here
[Magento root]/app/design/frontend/[your theme package]/[your theme]/template/persistent/customer/form/login.phtml
If you want send mail when someone add product to cart (or something else) you have to check about observer (events handler) on Magento.
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
I am building an E-Commerce Website with Wordpress using the WooCommerce plugin. Trying to add a feature for customers to add a photo to their profile page. I want this to be manadorty so if the client did not upload photo, I want it to be requested at the process of checkout.
How should I go about this, I been looking all day and can't even find the right file that I am supposed to be editing. Thanks in advance.
You need :
Add a form in my-account.php (Check woocommerce_before_my_account hook for this)
Create a custom code to save the file in wp_usermeta table (Check add_user_meta() function ).
Check woocommerce hook after_woocommerce_pay to check if there is a photo associated to current user