![]() ![]() Setup the duplicated product for WP functions (variable must be named $post)Ī custom field from this duplicated post: įatal error: Uncaught Error: Call to a member function get_meta_data() on int in /home/winecard/public_html/wp-content/plugins/woocommerce/includes/admin/class-wc-admin-duplicate-product.php:146 Stack trace: #0 /home/winecard/public_html/wp-content/themes/twentytwentyone/my-custom-page-template.php(41): WC_Admin_Duplicate_Product->product_duplicate(633) #1 /home/winecard/public_html/wp-includes/template-loader.php(106): include(‘/home/winecard/…’) #2 /home/winecard/public_html/wp-blog-header.php(19): require_once(‘/home/winecard/…’) #3 /home/winecard/public_html/index.php(17): require(‘/home/winecard/…’) #4 thrown in /home/winecard/public_html/wp-content/plugins/woocommerce/includes/admin/class-wc-admin-duplicate-product. ![]() ![]() Duplicate Post Page Menu & Custom Post Type is another popular free option for duplicating content on WordPress. Duplicate Post Page Menu & Custom Post Type. I’ve created this code, where ‘choose_product_via_relationship’ is my custom field This is the only new feature in the Duplicate Page and Post plugin. I want to to extent this functionality, so that this code it creates a duplicate of that product in woocommerce via build-in class [WC_Admin_Duplicate_Product – ( )).Īnd in my page, it will display the duplicated product You just need to remove the post ID from the data you pass to it, and Wordpress will create a new post instead of updating an existing one. I’ve used this code from ACF website to display these products You can use the wpinsertpost () function to duplicate a post. Hi I’ve created a custom page template with ACF fields responsible for retrieving woocommerce products. ![]()
0 Comments
Leave a Reply. |