Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Able to Create New Contents #7

Open
karamusluk opened this issue Dec 5, 2019 · 3 comments
Open

Able to Create New Contents #7

karamusluk opened this issue Dec 5, 2019 · 3 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@karamusluk
Copy link

Is it possible to create new contents (Post, Products, Upload Images) with this extension of corcel?

@Dartui Dartui added question Further information is requested enhancement New feature or request labels Sep 28, 2020
@Dartui
Copy link
Collaborator

Dartui commented Oct 3, 2020

It is possible even without this package, but it's not easy thing. You need to know product meta keys and you can create it in this way:

$product = Product::create([
    'post_title' => 'Product name',
    'post_content' => 'Post description',
    'post_status' => 'publish',
    // other wp_posts table columns...
);
$product->createMeta([
    '_sku' => 'some-sku',
    '_regular_price' => '10.00',
    '_sale_price' => '5.00',
    '_thumbnail_id' => 10,
    // other wp_postmeta product meta values...
]);

I will think about making this process at least a bit easier.

@xuark
Copy link

xuark commented Jul 7, 2021

is it possible to create order with the same method?

@Stevemoretz
Copy link
Contributor

is it possible to create order with the same method?

Came here for the same reason, even though technically it's possible cause order is just a custom post type but order items are stored in a different table, and there are several other tables for the orders so if not already built in, which is not.
It's not as easy as just create the order and update the metas.

You should change all the other tables (first have to know how all that works)

For these I usually use a webhook from php (laravel, lumeon,... pointing to a wp rest custom endpoint) and let the job be done on side of WordPress.

That way everything would work even if you use wpml which I do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants