Skip to content

Commit b0b3a2e

Browse files
authored
Fix: bug when update Woo product (#23)
* Fix: bug when update Woo product * Fix: bug when update Woo product
1 parent 4ee4f3a commit b0b3a2e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Post.php

+8-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@
44
use WP_Post;
55

66
class Post extends Base {
7-
public function update( $data, WP_Post $post ) {
8-
$this->update_values( $data, $post->ID, $post->post_type );
7+
public function update( $data, $post ) {
8+
if ( property_exists( $post, 'post_type' ) && 'product' === $post->post_type ) {
9+
$post_id = $post->get_id();
10+
} else {
11+
$post_id = $post->ID;
12+
}
13+
14+
$this->update_values( $data, $post_id, $post->post_type );
915
}
1016

1117
protected function get_types(): array {

0 commit comments

Comments
 (0)