Programmatically duplicate a layout

Hi, is it possible to programmatically duplicate a layout and change the assigments?

I am trying to create a shop portal where the seller can choose a product layout of their liking for their products. Hope this makes sense.

Hey @sgchan,

Thanks for reaching out!

Yes, you can duplicate the layout but you need to manually do it. There’s no option to do it programmatically.

If you share more information on how your website works, maybe we can give you an option or advise on how you can achieve it.

Cheers!

hi @marc_a
I am trying to set up a WooCommerce subscription portal for writers. If you subscribe to Writer A, then you get to read all premium content of Writer A. In other words, Writer A is a product.

When a writer registers to the portal, I want to give them the option to choose a layout (i.e. PRO layout) for their subscription page (or technically, it is a product page).

I hope this makes sense.

I noticed the layouts are saved in the wp_post table in the post_content field as a serialized array. I am thinking of duplicating the record and making the appropriate changes. For instance, the GUID needs to change according to the post ID. The ‘assignments’ key in the serialized array could be adjusted to our needs. Will this work?

Many thanks in advance.

Hello @sgchan,

Regretfully what you are trying to do requires custom coding. It is beyond the scope of our support by the way. You may need to contact a 3rd party developer to be able to accomplish what you have in mind.

Thank you for your understanding.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.