Skip to content

Enroll Student Using WooCommerce Order API #1575

@0xrmd

Description

@0xrmd

When I try To Enroll Student To Tutor lms From App Using WooCommerce REST API using https://zamakane.com/wp-json/wc/v3/orders And This Body in Postman

{
    "status": "completed",
      "set_paid": true,
      "billing": {
        "address_1": "1234 Main Street",
        "city": "Alger",
        "first_name": "Mohamed",
        "last_name": "Mohamed",
        "email": "rami63879@gmail.com",
        "phone": "0555555555"
      },
      "shipping": {
        "first_name": "Mohamed",
        "last_name": "Mohamed",
        "address_1": "1234 Main Street",
        "city": "Alger",
        "state": "DZ",
        "postcode": "16000",
        "country": "DZ",
        "phone": "0555555555"
      },
      "line_items": [
        {"product_id": "8585", "quantity": 1}
      ],
      "coupon_lines": [
        {"code": "rueptb53"}
      ]
}

I Get response Code 500
This is Full response
{
"code": "internal_server_error",
"message": "

كان هناك خطأ فادح في هذا الموقع.

<a href="https://wordpress.org/documentation/article/faq-troubleshooting/\">معرفة المزيد حول استكشاف الأخطاء في ووردبريس.

",
"data": {
"status": 500,
"error": {
"type": 1,
"message": "Uncaught Error: Call to a member function has_session() on null in /home/u262783969/domains/zamakane.com/public_html/wp-content/plugins/tutor/classes/WooCommerce.php:694\nStack trace:\n#0 /home/u262783969/domains/zamakane.com/public_html/wp-includes/class-wp-hook.php(324): TUTOR\WooCommerce->course_placing_order_from_customer()\n#1 /home/u262783969/domains/zamakane.com/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()\n#2 /home/u262783969/domains/zamakane.com/public_html/wp-includes/plugin.php(517): WP_Hook->do_action()\n#3 /home/u262783969/domains/zamakane.com/public_html/wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-item-type-data-store.php(93): do_action()\n#4 /home/u262783969/domains/zamakane.com/public_html/wp-content/plugins/woocommerce/includes/class-wc-data-store.php(186): Abstract_WC_Order_Item_Type_Data_Store->create()\n#5 /home/u262783969/domains/zamakane.com/public_html/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-data.php(241): WC_Data_Store->create()\n#6 /home/u262783969/domains/zamakane.com/public_html/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php(293): WC_Data->save()\n#7 /home/u262783969/domains/zamakane.com/public_html/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php(225): WC_Abstract_Order->save_items()\n#8 /home/u262783969/domains/zamakane.com/public_html/wp-content/plugins/woocommerce/includes/class-wc-order.php(270): WC_Abstract_Order->save()\n#9 /home/u262783969/domains/zamakane.com/public_html/wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-orders-controller.php(274): WC_Order->save()\n#10 /home/u262783969/domains/zamakane.com/public_html/wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php(205): WC_REST_Orders_Controller->save_object()\n#11 /home/u262783969/domains/zamakane.com/public_html/wp-includes/rest-api/class-wp-rest-server.php(1292): WC_REST_CRUD_Controller->create_item()\n#12 /home/u262783969/domains/zamakane.com/public_html/wp-includes/rest-api/class-wp-rest-server.php(1125): WP_REST_Server->respond_to_request()\n#13 /home/u262783969/domains/zamakane.com/public_html/wp-includes/rest-api/class-wp-rest-server.php(439): WP_REST_Server->dispatch()\n#14 /home/u262783969/domains/zamakane.com/public_html/wp-includes/rest-api.php(449): WP_REST_Server->serve_request()\n#15 /home/u262783969/domains/zamakane.com/public_html/wp-includes/class-wp-hook.php(324): rest_api_loaded()\n#16 /home/u262783969/domains/zamakane.com/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()\n#17 /home/u262783969/domains/zamakane.com/public_html/wp-includes/plugin.php(565): WP_Hook->do_action()\n#18 /home/u262783969/domains/zamakane.com/public_html/wp-includes/class-wp.php(418): do_action_ref_array()\n#19 /home/u262783969/domains/zamakane.com/public_html/wp-includes/class-wp.php(813): WP->parse_request()\n#20 /home/u262783969/domains/zamakane.com/public_html/wp-includes/functions.php(1336): WP->main()\n#21 /home/u262783969/domains/zamakane.com/public_html/wp-blog-header.php(16): wp()\n#22 /home/u262783969/domains/zamakane.com/public_html/index.php(17): require('/home/u26278396...')\n#23 {main}\n thrown",
"file": "/home/u262783969/domains/zamakane.com/public_html/wp-content/plugins/tutor/classes/WooCommerce.php",
"line": 694
}
},
"additional_errors": []
}
Please Help To Fix This

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions