After export from a subsite to another the add to cart is not working

After exporting from a subsite to another the add to cart is not working. There is an error in the console

Failed to load resource: net::ERR_NAME_NOT_RESOLVED
and it is showing a url for this as without the site url
https://wp-admin/admin-ajax.php?action=mp_update_cart

And also the price in all the products are changes to $0

Marketpress is Network activated. Trying to import content of an existing site to a new site using wordpress tools > export/import
Do not like to use Cloner or Blog Template For this. Please also mention if there is any function we can use to create the marketpress pages automatically at the time of creating site.

  • Adam Czajczyk
    • Support Gorilla

    Hello antonimike

    I hope you're well today and thank you for your question!

    I checked your chat in order to get the better picture of the case so let me start with giving some additional explanation :slight_smile:

    MarketPress products are indeed custom post types but the default one is in fact "product" and not "mp_product". If on a site that you're exporting from it is "mp_product", that would mean that it was changed in MarketPress settings ("Store Settings -> General" page -> "Advanced Settings" section).

    When you're importing/exporting using WP export/import tool, it doesn't care for what is/was set - it literally and explicitly exports the specific, select post type.

    However, if you set MarketPress on a new site, with default settings, the default product type there will be "product" and not "mp_product". So, for that new MarketPress instance such imported posts of "mp_product" type will be invisible.

    You have tried that with changing "mp_product" to "product" in exported XML, if I correctly understand. This would cause MP to see those posts (imported products) but it's still not a solution as it doesn't affect MP settings in any way. There's also much more to this than just "post data".

    Unfortunately, generic WP import/export does not work well with MP data (products and everything related) as it's much more complex data structure and I would strongly recommend against using that. If you do not want to use either Cloner or New Blog Templates plugins, you would need a custom developed (custom coded) export/import tool for that. However, custom development is outside the scope of this support so you might consider asking a question on our "Jobs & Pros" job board (please note: no WPMU DEV staff involved!) here:

    https://premium.wpmudev.org/wordpress-development/

    Having that said, let me ask you if there's any specific reason why you'd rather avoid New Blog Templates plugin?

    From what I read in the chat, it actually seems like a perfect solution as with it you could very easy add any number of sites to your Multisite (simply by going to "Network Admin -> Sites -> Add new" where the process is no different than standard WP process for that) with those new sites having already properly set up MarketPress pages and products and pretty much everything else you'd want to get them set...?

    Since this is a native WP process, I believe you could even hook to it using core WP hooks to fully automate it (e.g. trigger with "one click" button or automatically create on some schedule and so on).

    Kind regards,
    Adam

  • antonimike
    • Design Lord, Child of Thor

    I have check the product page on my site "https://myfunnelhost.com/megatron/store/products". I have found the glitch in this "MP_press" as the "data-ajax-url" is not getting the right url or domain. I have not pointed any domain for now you can check the screen shot here.

    http://nimb.ws/HrpDxd

    We need that "data-ajax-url" is "https://myfunnelhost.com/megatron/wp-admin/admin-ajax.php?action=mp_update_cart" Not "https:///wp-admin/admin-ajax.php?action=mp_update_cart" please look it into this Keep in mind if I point any domain it will auto change the URL as "https://mydoamin.com/wp-admin/admin-ajax.php?action=mp_update_cart". I have checked by change in console and it is working fine.

  • Adam Czajczyk
    • Support Gorilla

    Hi antonimike

    Please disregard my post above. I hit "publish" by accident and I cannot remove it, unfortunately.

    As for the issue. You are right, there should be a full url. Furthermore, it should be there even if you do not "point any domain" to it; it should use default current URL of the site (just like this form's "action" attribute does).

    I admit that this is quite a weird issue and might actually be a glitch/bug in the plugin or some "yet undiscovered incompatibility". It's also possible that something on the site is "stripping" that out.

    That said, tell me please:
    - that /megatron/ site is a cloned site (using Cloner), right? Or is it set "your way" (using export/import)?
    - from which site of the multisite it was cloned (or products imported)?

    Also, could you please temporarily disable "Adminer", "Elementor", "Domain Mapping" plugins and - without making absolutely any additional changes, check if that starts to work then? If yes, enable one of them and check again and so on until it breaks again and let me know after which one.

    Finally, is there any custom code on the site that I might not be aware of that might interact with admin-ajax or do use jS/jQuery?

    Best regards,
    Adam

  • Adam Czajczyk
    • Support Gorilla

    Hello antonimike

    Have you used "Multisite Cloner": https://wordpress.org/plugins/multisite-cloner/ or our "Cloner": https://premium.wpmudev.org/project/cloner/?

    I'm asking because I assumed we were referring to our Cloner plugin before and these are two different tools.

    Also, which of the sites was and actual source of the /megatron/ one - from which specific sites of your site it was cloned?

    This is important because I need to check that source site too, to try to replicate the problem. I have just completed a couple of tests and it seems that we're actually dealing with two issues at once here, one of them being related to MarketPress + Domain Mapping (which is known to developers already) and an additional one that "messes that up" even more, stripping out those URLs from "data-ajax-url" (which is the part that I so far couldn't replicate).

    Also, since you're not able to disable any plugins (I understand that this is a live working site), would you be able to setup a staging site so we could safely test whatever's necessary? Such site should be an exact copy of the current setup (full multisite "as is") just in some sub-domain/spare domain/sub-folder on the same server. If you could set that up that would be great, I'd let you know about safe way to provide us with all the necessary access credentials.

    Kind regards,
    Adam

  • Adam Czajczyk
    • Support Gorilla

    Hello antonimike

    Thank you for your response!

    I've run some more tests and I was finally able to fully replicate this. It's a glitch in MarketPress related to the "Domain Mapping" plugin, it's already reported to our developers and the fix is on a way (though I'm not able to give you an ETA on a release).

    The issue is not related to copying/clonning the site but rather to the way MarketPress is fetching admin ajax URL on setups with Domain Mapping enabled.

    Once the fix is released it will be included in MarketPress update. I have also included a "hot-patch" to this post for you so if you want to give it a try here's how to apply it to the site (it's one fix for entire Multisite setup):

    - download the "mp-dm-cart-patch.zip" file from this post
    - extract it to your local drive
    - access the site via FTP (or cPanel "File Manager" or similar tool)
    - go to the /wp-content/plugins/marketpress/includes/common/ folder on a server
    - rename "template-functions.php" file to e.g. "template-functions.phpORG" (in order to keep a backup and be able to restore it if necessary)
    - upload "template-functions.php" file from inside the .zip file that I shared to the server (to "/wp-content/plugins/marketpress/includes/common/") folder

    That should fix the cart issue right away. If you decide to give it a go, please let me know here if you can confirm the fix is working for you.

    Best regards,
    Adam

  • antonimike
    • Design Lord, Child of Thor

    It's working fine now with the site which have no domain pointed to it . But your file have error on the site which have "actual domain" pointed.
    i.e if I replace your file then site are working "https://myfunnelhost.com/testeeers/" fine. But give ajax url error for real domain like "pixxecom.com"

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.